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.

Newcomers DBPro Corner / Need Urgent Help - Need to duplicate enemy and make it shoot

Author
Message
strider85
19
Years of Service
User Offline
Joined: 6th Apr 2005
Location:
Posted: 9th Apr 2005 01:15
I am making a 2D spaceship scrolling shooter. I am using a tutorial code in the 2D forum as a template. I have a player that moves and shoots and does everything it should, and i have one enemy that flies down but doesnt do anything.

I really need to know how to use the enemy sprite and duplicate it so that it appears over and over at randomly, as the level should end when the player kills 20 of them (5 points each = 100points). For the x and y co-ords of the enemy i am using the RND command which seems to work. I just need some way of getting more enemy ships to appear.
Also if anyone could tell me how to get the enemy ship(s) to shoot forward at random intervals that would be a BIG help.

Oh and i also need help moving onto the next level. I have NO IDEA how to create a new level and move onto it after the player has 100points.

Check out my code, any help would be brilliant
Mr Pointless
19
Years of Service
User Offline
Joined: 17th Oct 2004
Location: Stuck in the UK
Posted: 9th Apr 2005 06:04
You'll need multiple sprites for this.

Basically the most obvious way (to me) to create said enemy sprites would be to first have this after loading the enemy image:


(X) and (Y) should be replaced with the intended X and Y coords (try hiding them off screen) and (image number) is just the number of a loaded image. You can have any sprite number but I only used 100 onwards as an example. Basically to tidy things up. I like to separate groups of sprites to avoid confusion if I leave a project for a while.

To make them actually appear on screen:
for a = 0 to (however many you need minus 1)
sprite 100+a,(X),(Y),(image number)
next a

does the job.

See how far you get with this for now and just say if you need more help. I'll be able to help further on this post, but I'd probably end up feeding you too much info at a time.


Iwata: "YOU'RE NOT HIM! YOU'RE NOT SUMIYOSHI! EEEEYAAAAAA!"
Sumiyoshi: "Who am I then?

Login to post a reply

Server time is: 2024-09-23 17:28:24
Your offset time is: 2024-09-23 17:28:24