Platformer enemy

i made a platformer im almost finished with it but there is something wrong the monster. it keeps on flipping from side to side without moving. i want it when it reaches the edge it flips and goes the other way and flips (right and left).

2 Likes

Forward direction right.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-90,"y":-32,"group":"","id":"c7dcc9b671d2594a"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":-32,"group":"","id":"c7dcd36b159fb947","startVal":5,"tag":"","roundMode":1},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":270,"y":-32,"group":"","id":"c7dd004e8c0c2343"},{"inputCount":3,"outputCount":3,"name":"Flip","behaviorType":"logic.properties.Flip","x":270,"y":96,"group":"","id":"c7dd190bdb8a5e49","spriteOnly":false},{"inputCount":0,"outputCount":1,"name":"Collision","behaviorType":"logic.triggers.Collision","x":-90,"y":96,"group":"","id":"c7dd29a40efe9d42","targetClassId":0,"targetEntityId":0,"collisionFilter":12,"collideWithEntity":false,"delay":0},{"inputCount":2,"outputCount":2,"name":"Toggle","behaviorType":"logic.logic.FlipFlop","x":90,"y":96,"group":"","id":"c7dd3aa7f8fcff41","loop":true,"initialState":0}],"links":[{"input_id":"c7dcd36b159fb947i1","output_id":"c7dcc9b671d2594ao0"},{"input_id":"c7dcd36b159fb947i1","output_id":"c7dcc9b671d2594ao0"},{"input_id":"c7dd004e8c0c2343i2","output_id":"c7dcd36b159fb947o0"},{"input_id":"c7dd004e8c0c2343i2","output_id":"c7dcd36b159fb947o0"},{"input_id":"c7dd190bdb8a5e49i0","output_id":"c7dd3aa7f8fcff41o1"},{"input_id":"c7dd190bdb8a5e49i1","output_id":"c7dd3aa7f8fcff41o0"},{"input_id":"c7dd3aa7f8fcff41i0","output_id":"c7dd29a40efe9d42o0"},{"input_id":"c7dd3aa7f8fcff41i1","output_id":"c7dd29a40efe9d42o0"},{"input_id":"c7dd3aa7f8fcff41i0","output_id":"c7dd29a40efe9d42o0"},{"input_id":"c7dd3aa7f8fcff41i1","output_id":"c7dd29a40efe9d42o0"},{"input_id":"c7dd190bdb8a5e49i1","output_id":"c7dd3aa7f8fcff41o0"},{"input_id":"c7dd190bdb8a5e49i0","output_id":"c7dd3aa7f8fcff41o1"}]}}}

copy and import.

1 Like

its not working look at the enemy

game link please.

I know it is working so please stop telling me that the code is not working - it’s something you are doing wrong…

then why is the monster not moving while its going left and right?

Game link please.

Is it movable??? Make sure you are get the number not setting it, make sure the enemy has collision enabled, make sure enemy has gravity enabled, make sure enemy is solid, make sure you have it affecting the entire object not just the sprite, make sure the number isn’t zero, make sure everything is connected correct, make sure you did everything. If not redo the code then read this post again.

1 Like

Or even better yet find and example on the help tab

1 Like

Turn off top and bottom collisions

Also, you might consider changing the floor to rectangle collision shape