Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | kronopy |
I am working on a small platform game. The character will kill the enemies by hitting the bricks from under them, like Super Mario Bros or Bonkheads. When I hit the brick, it must move above for few pixels (around 10 I think), then return to it’s initial position. When an enemy is on the brick the enemy must also jump and fall to another action (probably death) on the initial position (back on the brick). I’ve been trying to figure out how to make it, and the Idea I come up with is to add multiple layers, but the way I think of making it seem overly complicated. My idea is:
layers 1 → collision shape on the brick for walking.
layer 2 → collision shape with static sprint above the brick to force the brick to return to initial position once is hit. I am basically pushing the brick trough the collision shape, by making the brick less heavy than the player.
layer 3 → area2d/body_entered over layer2 to make enemy go into jump animation and death.
To be honest I am not even sure if this would work overall (I anticipate many complications as the enemy get diversified), is just some physics I discovered by accident while playing with the engine doing Pong.
I am sure there must be a much simpler way, and I watched trough almost every of tutorial for Mario clones and such, but there was nothing helpful, everyone seems to hate bricks and destroy them TT TT This is a project I started as a way to learn the engine and familiarize myself with the script, but I am growing fond of it and thinking of making it into a full game. Using my method for 100 levels sounds like… I need something more minimalist.
Also, can you recommend me the best choice between Kinematic2DBody and RigidBody for this?