Jam when creating endless runner.

tintrantintran 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

  • ArmellineArmelline Member, PRO Posts: 5,365

    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.

  • tintrantintran Member Posts: 453

    @Armelline said:
    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.

    I think i'll just use an actor then to keep it simple. thanks.

  • pHghostpHghost London, UKMember Posts: 2,342

    @tintran said:
    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.

  • tintrantintran Member Posts: 453

    @pHghost said:
    No need for constrains or invisible actors.

    This doesn't seem to work for me...maybe because I have a constrain velocity.x = 300

  • skipniceskipnice Member, PRO Posts: 68

    track player motion in self.player, motion <1 or zero or somthing, reset scene?

  • BBEnkBBEnk Member Posts: 1,764

    @tintran said:

    This doesn't seem to work for me...maybe because I have a constrain velocity.x = 300

    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.

  • tintrantintran Member Posts: 453

    @BBEnk said:
    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.

  • tintrantintran Member Posts: 453
    edited July 2015

    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.

Sign In or Register to comment.