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 / Enemy respawn

Author
Message
nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 20th May 2008 20:09 Edited at: 20th May 2008 20:59
Hi everyone. I need to know how to make an enemy respawn in a random location when it comes outside the screen (I have made a box, which it gets contact with to respawn)

Study the attached image to get an understanding of what i mean.

Thanks in advance, and please help me if you can, thank you. The game is 3D.

Footsteps W.I.P
Trala'em Goes Oblivion (TES IV Mod)

Attachments

Login to view attachments
Must Program
17
Years of Service
User Offline
Joined: 22nd Nov 2007
Location:
Posted: 20th May 2008 20:49
oh i understand what you want done and the only help i can give you is this

what i would do is put it on a small loop.

so a certain amount of enemies come down and then when they have all come down they will go back to the beggining of your loop and fall all over again example

Do

[your code for faling enemies]

loop

by the way i would keep other points systems out of your loop or it will keep resetting points aswell


hope i helped
nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 20th May 2008 20:53
Yes, i have done the loop for falling enemies, but the thing i need help with is not how to make the enemy fall down, it's how to make them respawn in the game area in a random position.

Footsteps W.I.P
Trala'em Goes Oblivion (TES IV Mod)
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th May 2008 21:22
Each enemy is positioned with an X, Y and Z position variable (or should be). When these variables fall within the X and Z position of the 'kill zone' you hide the enemy object.

You then use Rnd to create new X and Z positions within the Spawn zone, position the respective enemy at the new position and unhide it.

When hiding/showing enemies, you can apply whatever dying/respawning effects you want.

TDK_Man

nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 20th May 2008 21:32
I think i understand. Thanks. I'll report back if i get any errors.

Footsteps W.I.P
Trala'em Goes Oblivion (TES IV Mod)
nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 20th May 2008 22:04 Edited at: 20th May 2008 22:45
Something really strange happened.. When the enemies respawn, they always respawn on the LEFT side of the game area. How do i fix this problem?

This is how i did the random spawn code:



EDIT, I fixed the problem, i forgot to put a "-" before the rnd(35) on the objects.

The problem is solved, thanks everyone for the help. My game is as good as finished now, some music and finishing touches and it's going for a program announce! (My ever first game in DBPro!)

Footsteps W.I.P
Trala'em Goes Oblivion (TES IV Mod)

Login to post a reply

Server time is: 2024-11-25 23:24:01
Your offset time is: 2024-11-25 23:24:01