Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / laser cannon

Author
Message
geosween
16
Years of Service
User Offline
Joined: 19th Feb 2009
Location:
Posted: 19th Feb 2009 13:50
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.


Stefan p
16
Years of Service
User Offline
Joined: 2nd Nov 2008
Location: Online
Posted: 19th Feb 2009 14:15
You can do this if
Bullet Y =< screenheight() then delete bullet/sprite:ammo = 1

( the y of your laser ) = screenheight()( the bottom of screen if you want top then hit zero)

All fears must be overcome before feeling true happieness.
By Stefan aka me
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Feb 2009 14:20
That is correct, but you need a space between the "screen" and the "height()":

screen height()

Are you using sprites? Or objects?

If using sprites, you can get the y coordinate with this:

y=sprite y(sprite number)

TheComet

Peachy, and the Chaos of the Gems

geosween
16
Years of Service
User Offline
Joined: 19th Feb 2009
Location:
Posted: 20th Feb 2009 12:16
i am using sprites. what values is it that i put in the
screen height ()
the y coordinate ?
thanks for your help so far.

Login to post a reply

Server time is: 2025-05-18 18:57:21
Your offset time is: 2025-05-18 18:57:21