Hello, guys !
I wanna create a simple TD like game, what is the flow.
- Creeps must spawn on given fixated location (spanw point).
- Creepers must spawn one after another with 500 ms time in between spawns.
- Creepers must follow predefined path, on colision with tile on which they step, they would get tile’s metadata and decide at what position they should move.
There are 2 problems with my realisation of those cases.
- Creepers seems to spawn not on same point but a little back one after another, also it seems that they collide at different points with first tile, after they are spawned ( you can see that they are not in exact row one after another)
- The more creeps they are, the bigger displacement of position is… when they should follow the exact same path one after another.
So my question is:
What should I do in order for each creep to spawn one after another (500ms) and each creep walk the exact same path without any displacement.
Thanks in advance !!!
There is playground.
- It is a really shallow and hardcoded code of what I have, but it does show the problem.
- Sorry for big map asset, still new to blender and those kind of stuff, will look what can I do to optimise. ( slow download )
Hi! welcome to the forum
From looking at your playground, it seems like you apply different movement speed when colliding with different colliders, and you are checking for collision and applying the movement based on those collisions. You change the global movement speed that is applied to everyone if one creeper collided against a rock, which will change the movement speed of the next creeper and so on.
I assume you wanted to set movement speed per creeper, but kept it global?
You assume correct, I am setting the movement speed and rotation only for given creeper. This part of the code ( where we are creating creeper and setting movements ) is usually in creeper class (didn’t saw a nice way to create classes in playgrounds, that why everything is in one piece, but the logic is the same) and those properties are global, the idea is if creeper pass through any tile that doesn’t have set speed or rotation to keep last one that he went through only for himself, not for others.
I’ve just edited playground because I saw that I have forgot to add rotation in global variables when rewrite the code in playground, sorry.
Thanks for the reply !
There is the new playground.
Edit: On second read of your question I do see where the mistake may be. My idea might be that each creep have its own properties but I am never creating new instance of creep, I am just cloning it into the same execution context, so those rotation and speed properties are global to all creeps and changing speed of all creeps… will see later when i get home. Thanks one again !