Jam when creating endless runner.
tintran
Member Posts: 453
After viewing this video (on how to create an endless runner).
I tried my own,
I created a platform that's really low like on the ground and want the player to jump over it, otherwise if the player gets jammed because he's no longer running, i want the level to restart.
My question is how do i detect this? How do i detect the fact that the runner has hit the side of land and stopped moving.
I was thinking maybe i can create another invisible actor and place it at the side of my platform, but was wondering if there was a better way to detect this.
Comments
You could say "When ground collides with player and player's position.x is <= ground position.x-(ground.width/2) and player.y > ground.y+(ground.height/2) then do x".
But the invisible actor saves you constraining the player's position to a game attribute. If you're constraining it anyway, then doing it this way saves an actor.
Using an actor really isn't a big deal at all though, no real need to overcomplicate things.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I think i'll just use an actor then to keep it simple. thanks.
How about a rule:
When ground collides with player and player's linearVelocity.x is < 0.05
No need for constrains or invisible actors.
This doesn't seem to work for me...maybe because I have a constrain velocity.x = 300
track player motion in self.player, motion <1 or zero or somthing, reset scene?
@tintran said:
Instead of using constrain to move actor use Accelerate but set it's speed high like 1500 or ETC, and then limit your actors top speed to 300 in it's properties, That way PHghost rule will work, and you will still get high start speed no build up.
I tried this, and what i noticed is the the max speed also restricts my jumps since my jump is changing velocity.y to 500... it makes my jumps really low. so this solution might not work for me. To bad there isn't away to only restrict max x velocity.
I think i might have found a way (to use this velocity x < 0.05 check)
By setting initial velocity x to 300 and then set friction to zero.