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 / Space Invaders Clone

Author
Message
soapyfish
21
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 25th Oct 2003 19:35
Hey, I'm trying to make a space invaders type game. I've made an enemy sprite but don't know how to put 10 in a row at the top of the screen without typing some code out 10 times. Can anyone give me some advice.Thanks.

why do I always get so confused?
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 25th Oct 2003 19:37
For x=1 To 10
Rem put in your pasting for the sprite here, eg:
sprite x,120,230,1
Next x


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 26th Oct 2003 02:45
You could also use an array

dim spaceinvaders$(10)

spaceinvader$(1)=

and so on

Axel Waz `Ere
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Oct 2003 07:58
Um, no, i think your thinking of moving the sprite Axelman...

To do it, use somethign like:


That will make a sprite with a number of "x", ie numbers form 1 to 10.
And will position it on the x axis of the screen at x*20, that is, if x = 5 then, it would be positioned at 5*20 = 100 etc.etc.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
soapyfish
21
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 26th Oct 2003 17:25
I put this in

but this don't work I think its putting all 10 sprites on top of each other . Maybe if I use the STEP command that will help.
i.e.


thanks to all for help by the way.

why do I always get so confused?
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th Oct 2003 03:59
no, step wont help at all...

Use this:

that will make sprites wiht the number "n" (which is whatever number that the loop happens tobe up to) and will position them at n*20,70


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
soapyfish
21
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 1st Nov 2003 15:56
thanks to all that helped I've sorted my problem now.

why do I always get so confused?

Login to post a reply

Server time is: 2025-05-21 10:18:01
Your offset time is: 2025-05-21 10:18:01