0 Favourites

# Making a Freerun game.

• 9 posts
• Hello friends !

I am trying to make a free run game.. I have a group of enemies that spawn in the game depending on the distance covered by the player.

These enemies will stop spawning after a specific distance..and then will respawn again after the player has traveled a set distance..

so fr example..

spawn enemy1 when the player distance is between 0 to 500 mts

spawn enemy2 when the player distance is between 250 to 750 mts

spawn enemy3 when the player distance is between 500 to 1000 mts

the type 1 enemy spawn will stop when the player distance >= 500

type 2 enemy spawn will stop when the player distance >= 750 and so on..

this is kinda easy..to achieve..

I have 4 types of enemies in the game..

Each of them spawn after a set amount of distance..it's easy to make them spawn the first time.

but as the player progresses in the game..with covering more distance i want to make the same enemies come back with more health

so for example..after 1000 mts

spawn enemy 1 with health 2 player distance is between 1000 to 1500 mts

spawn enemy2 with health 2 when the player distance is between 1250 to 1750 mts

spawn enemy3 with health 2 when the player distance is between 1500 to 2000 mts

This should work in a loop for every thousand meters and the enemy should respawn with +1 health every loop.

Avichal

India

• bump

• Well, if you've got the first part down, should be pretty simple to change the rest. Let's see... set enemy health to (1 + (Int(Player.X/1000))) and you should be good forever and ever. Every tick, set a global variable (let's just call it FirstGlobalVariable) to be (Player.X - SecondGlobalVariable). SecondGlobalVariable starts at 0; afterwards, every time FirstGlobalVariable >= 1000, add 1000 to SecondGlobalVariable.

�Bueno!

• (Except replace "1000" in all instances of my post with whatever X value equates to 1000 meters for you.)

• i tried doing that.but it doesnt work..maybe i didnt get it right..

here's a screen of what i got.

http://imgur.com/EKQOa

• How do you check your distance between player and enemy?

distance(x1,y1,x2,y2) or simple x > some number ?

You could try set enemies health based on distance or use conditionals

enemy distance < 1000 ? 1:2

• The distance is the score in the game. The same set of enemies will spawn after every 500 mts but with increased health every time they spawn in the next set.

The enemies spawn at player.x+some number, random(some number, some number)

now when do they spawn

1st set of enemies spawn when the score 0 to 500

every X seconds (score is a global variable, which is set to player.x)

2nd set of enemies spawn when the score is between 250 -750 mts

every X seconds

3rd set of enemies spawn when the score is between 500-1000 mts, every X seconds

4th set of enemies spawn when the score is between 750-1250 mts, every X

• i am trying to make this run in a loop...for every 500 mts distance covered in the game.