Downblock - Seasoned revised code

in Game Developmentlast month (edited)

▶️ Watch on 3Speak


So adding features and object to the world I took something from the past to quickly integrate something new to the project in these time dry period. The block that allow the player to descend is kinda of a must in every 2d side scroller so I went back and took the code from Cycle Song down stepping blocks.

OLD CODE

csdcd.png

Problem is that the code was kinda rough for a simple 2d platformer now adding the physics implementation I was thinking in encountering many problems so the idea was to use the static object in the room such as a creator of downblock and the player activator instance wich is all the time centered where the player is.

ADATPTING

ththt.png

This solved some problems but then I encountered other issues when checking if the player was jumping from it or passing through.
It took quite a lot of knocking the head against the wall but here is the final results as shown in the video, with checking if the the activator Y position is above respect to the block creator one.

FINAL

sdfsfeffeef.png

Well onto creating some game room to test it out and find this solution ricocheting back ahah


▶️ 3Speak

rtnhsd.png

Sort:  

Nice! Any progress, no matter how "small," is great progress. Hunting down those logic issues is difficult, but always offers a great sense of reward when finally completed!

Yeah sometimes is hard to say Im happy with results as these stuff seems to have always a way to be improved