Hammerit wrote:Do i need to write collision event for each monster and platform in the game individually?
How i can copy all collisions to a new monster or tile with little code change?
For monsters you can set up one monster, that you don't use in the game but you keep it off screen somewhere.
This monster will have all the code that is identical for all other monsters.
Then when you create a new monster, on the actor panel you can set "inherits events from:" the original off screen monster.
In the new monster you can then code all the events that are different for this new monster.
For the tiles the same method could also work. But then you will have to change the code you are using now.
Now the code is on the hero. So when he collides with the ground it is the hero actor that controls the code.
If you would change it and put the code on the collision events of the ground actor (the one with the tiles), the you could have an off screen tile actor have all the collision codes. And then you could have the other tile actors inherit this.
In the physical response you replace "event actor only" by "colliding actor only".
Keep in mind that you will possibly want different collision events when the platforms are moving.
Hammerit wrote:Or that's what programmers-gamemakers do: writing and copying same code for each collision in the game and then changing a little?
That is also possible. But it is more work, and when you want to change the code afterwards you will need to change it in all the copies too.
Hammerit wrote:Curse my perfection and lazynes.
Bless your perfection and lazynes