i am currently creating a game for my advanced higher project. the principle behind my game is that there are enemies goin from left to right and you must shoot them using the laser cannon fired using the space bar.
however at the moment, when you fire the laser cannon it shows at a random y coordinate and then continous up the screen.
my aim is to have the laser, when fired using the spacebar, continue up the screen but when it reaches the top of the screen it will reload and be ready to fire again.
REM begin loop
do
REM add movement to the user sprite, allowing
REM the user to control it using the cursor keys
sprite 1,x,y,1
IF LEFTKEY()=1 THEN x=x-8
IF RIGHTKEY()=1 THEN x=x+8
REM limit the ships movement so that it does not disapper off
REM the edge of the screen
IF x<0 THEN x=0
IF x>600 THEN x=600
SYNC
REM adds movement to the enemy sprite 1.
sprite 2,a,b,2
IF a=0
rightofscreencounter=1
leftofscreencounter=0
ENDIF
IF rightofscreencounter=1 THEN a=a+30
IF a=600
rightofscreencounter=0
leftofscreencounter=1
ENDIF
IF leftofscreencounter=1 THEN a=a-30
REM adds movement to the enemy sprite 2.
sprite 4,e,f,4
IF e=0
rightofscreencounter2=1
leftofscreencounter2=0
ENDIF
IF rightofscreencounter2=1 THEN e=e+20
IF e=560
rightofscreencounter2=0
leftofscreencounter2=1
ENDIF
IF leftofscreencounter2=1 THEN e=e-20
REM load in laser
REM when spacebar is used a laser cannon is fired from the user ship
sprite 3,c,d,3
c=x+8
IF SPACEKEY()=1
show sprite 3
endif
d=d-20
IF d<0
d=375
hide sprite 3
endif