Before i start, i would like to say hello to everyone here, and that I'm a newbie programmer. I have always wanted to create video games, that are not "main stream" something unique that a lot of us programmers strive for. I found BlitzPlus, a few days ago, and have been experimenting with it for four days now. And i have to hand it to the developers of this language, it's easy yet maintains some complexity. The complexity of it; is that I've never worked with BlitzPlus before. So, this leaves me with a huge knowledge gap. Here is the beginner code that comes with the software and i want to know if I'm doing this right. For example, i would like to know, if I'm writing the score variable along with the value in the proper spot below the Global variables. T
If iScore>0 Then
Text 200,200, "Score = "+iScore
Else
If iScore<0 Then
Text 200,200, "You're in the Negatives!"
Else
Text 200,200, "No Score Yet!"
EndIf
EndIf
This being the score variables and values under this.
;Create global variables here.
Global iMech = 100 ;Holds the current to Mech durability.
Global iArmor = 50 ;Holds the current to Armor durability.
Global iShields = 50 ;Holds the current to Shield durability.
Global iStructure = 50 ;Holds the current to structure durability.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Commenting code demo!
;; Developed by: Krylar
;; Last Revision: 10/09/2000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Setup constands.
Const g_ScreenWidth=800, g_ScreenHeight=600
;create constants here
;Holds scan-code of keyboard's spacebar
Const kSpacebar = 57
;Call BB Graphics rutine, to initialize Direct X
Graphics g_ScreenWidth, g_ScreenHeight
Graphics 1024,768
;Setup BlitzBasic to support page-flipping
SetBuffer BackBuffer()
;Create a global variable for the player's image.
Global g_PlayerImage
;Create globals to keep track of the mouse positions.
Global g_OldMousex=1, g_OlderMousey=1
;Create global variables here.
Global iMech = 100 ;Holds the current to Mech durability.
Global iArmor = 50 ;Holds the current to Armor durability.
Global iShields = 50 ;Holds the current to Shield durability.
Global iStructure = 50 ;Holds the current to Structure durability.
If iScore>0 Then
Text 200,200, "Score = "+iScore
Else
If iScore<0 Then
Text 200,200, "You're in the Negatives!"
Else
Text 200,200, "No Score Yet!"
EndIf
EndIf
;Create a type (This is similar to a C/C++ Struct)
Type MainMech
Field x#,y#
End Type
;Create an object of MainMech, called Mech.
Mech.MainMech=New MainMech
;Set the x,y for the Mech.
Mech\x#=1
Mech\y#=1
;Call BlitzBasic's LoadImage function, to load the .JPG. (.BMP works to)
;Make sure you put the proper path to the .JPG!
g_PlayerImage=LoadImage("C:\Users\Admin\Documents\Sprites\mechs\goodmech.jpg")
g_enemyImage=LoadImage("C:\Users\Admin\Documents\Sprites\mechs\badmech.jpg")
g_powerupImage=LoadImage("C:\Users\Admin\Documents\Sprites\powerups\powerup.jpg")
g_powerupImage=LoadImage("C:\Users\Admin\Documents\Sprites\powerups\1x.jpg")
g_powerupImage=LoadImage("C:\Users\Admin\Documents\Sprites\powerups\health.jpg")
g_effectsImage=LoadImage("C:\Users\Admin\Documents\Sprites\effects\laser1.jpg")
g_effectsImage=LoadImage("C:\Users\Admin\Documents\Sprites\effects\laser2.jpg")
g_terrainImage=LoadImage("C:\Users\Admin\Documents\Sprites\terrain\terrain1.jpg")
g_terrainImage=LoadImage("C:\Users\Admin\Documents\Sprites\terrain\terrain2.jpg")
;Main game loop, goes here.
;While the ESC key is not pressed
While Not KeyHit(1)
;If mouse position isn't the same as last loop,
;update the x,y coords for the Mech.
if g_OldMouseX<>MouseX() or g_OldMouseY<>MouseY()
;Update the X Coord for the Mech Placement.
Mech\x#=MouseX()
;Update the Y Coord for the Mech Placement.
Mech\y#=MouseY()
End If
;Save the current Mouse x,y
g_OldMouseY = MouseX()
g_OldMouseY = MouseY()
;Call BlitzBasic's DrawImage Function to put the Mech
;Up in the proper spot.
DrawImage g_PlayerImage, Mech\x#, Mech\y#
;Call BlitzBasic's Flip Function to Flip the pages.
Flip
;Clead the back buffer
Cls
;end of main loop.
wend
;Free the Mech Object
Delete Mech
;End of program.
End
|