Hello there, As DVader said, this should go in the DB forum. I looked through your code, and the first thing I would suggest is:
Rem Project: sprites215
Rem Created: Wednesday, March 28, 2012
Rem ***** Main Source File *****
` Define required data type
#CONSTANT plane12 1
#CONSTANT missile12 2
`Define required data types
TYPE VelocityType
speed AS INTEGER
angle AS INTEGER
ENDTYPE
TYPE PositionType
x AS INTEGER
y AS INTEGER
ENDTYPE
` Set up main variables
GLOBAL missilevelocity AS VelocityType
GLOBAL planeposition AS PositionType
`Main program logic
InitialiseGame()
DO
HandlePlane()
IF SPRITE EXIST(missile12)
HandleMissile()
ENDIF
LOOP
END
FUNCTION InitialiseGame()
`Set up missile velocity
missilevelocity.speed = 5
missilevelocity.angle = 0
` Set screen resolution
SET DISPLAY MODE 1280, 1024, 32
SET WINDOW POSITION 400, 0
` Set backdrop colour
COLOR BACKDROP RGB(64, 64, 255)
BACKDROP ON
` Set up plane sprite
LOAD IMAGE "media\starship.bmp", 1
SPRITE plane12, 640, 900, 1
` Load image to be used for missile
LOAD IMAGE "media\missile.bmp", 2
ENDFUNCTION
FUNCTION HandleMissile()
MOVE SPRITE missile, missilevelocity.speed
IF SPRITE Y(missile) < 0
DELETE SPRITE missile
ENDIF
ENDFUNCTION
FUNCTION HandlePlane()
` Find plane's position
planeposition.x = SPRITE X(plane12)
planeposition.y = SPRITE Y(plane12)
` Check for keyboard hit
keycode = SCANCODE()
` React to key pressed
SELECT keycode
CASE 52 `V (left)
IF planeposition.x > 8
DEC planeposition.x, 5
ENDIF
ENDCASE
CASE 53 ` Z (right)
IF planeposition.x < 1272
INC planeposition.x, 5
ENDIF
ENDCASE
CASE 57 `space (fire missile)
IF NOT SPRITE EXIST(missile12)
`Create missile sprite at top of plane
SPRITE missile12, planeposition.x + SPRITE WIDTH(plane12) / 2, planeposition.y, 2
ENDIF
ENDCASE
ENDSELECT
` Move the plane sprite to its new position
SPRITE plane12, planeposition.x, planeposition.y, 1
ENDFUNCTION
Get your code tabbed and organized. It will help a lot.
Secondly, I edited the code above to make it work. the word 'plane' is a reserved word in DBP (make object plane)
Can't use it as a variable. I switched it to "plane12" and it ran just fine.