Platform Runner (Like Panda Run) Actor Running + Collision problems

Hi All,

I really need some help here..

I am try to make a game like "Panda Run" where you create the level, spawn a actor & the actor auto runs through the level. All the player has to do is hit the jump button and get to the end of the level.

So far the only way I have been able to get the actor moving through the level is by using a move behavior self.position.x to 2400 (length of level) for 18 seconds and lock the camera to the actor. Problem is when the actor collides with a wall he runs right on through.

Is there a way to make the player collide with the walls properly? Or perhaps a better way for the play to auto run through a pre-made level?

I have tried accelerate and that fixes the collision but the actor then speeds up as he goes through the level (not what I want)..

I have also checked out Jamies tutorial on endless runners which is awesome but I want to pre design the whole level..

Comments

  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078

    go into the wall actor, untick moveable and turn bounciness to 0.
    Then go into your main actor and place a collide behaviour in there, to make it collide with the wall.
    also try using the "move" behaviour if you dont want to use accelerate.
    but using self motion velocity x should be fine.

  • JodyMitomaJodyMitoma Member Posts: 307
    edited April 2014

    Nice, I'm actually making a game that requires the exact same thing, and I've got it working wonders.

    Here's what I've done:

    [Accelerate: accelerate in direction 270 relative to scene with acceleration 2200.]

    [Collide: bounce when colliding with: actor with tag "SOLID".] (Make sure you give all the games platforms and walls a "SOLID" tag.

    [Control Camera]

    [If actor collides with actor with tag "SOLID", set self.jumps to "1".]

    [If touch is outside, AND if self.jumps = 1, then...
    ...set self.motion.linearVelocity.Y to 700 AND set self.jumps to "0".]

    [if self.jumps = true, then Animate (running animation sequence goes here), ELSE, Change Image to (an image of your guy jumping)]

    [Go into your Main Characters(Actor) attributes and set Linear Velocity to X 250.]

    ...

    Sorry if that got a little out of hand. Figured I'd help you with jumping while I was at it... Please, do make some changes to the above for your game, as these are my specific values. ;)

    On another note, my main character has 15 different Rules associated with it (I only showed you 8!) Haha, so insane. !@#$% gets complicated real quick!!

    GOOD LUCK!!

  • andrewpullosandrewpullos Member Posts: 2

    Thanks for the help guys,

    I have changed my jump settings to match what JodyMitomas has outlined & my actors attribute motion linear velocity X to 200 the actor now moves accross the screen & collides properly however..

    The bug i am getting now is when the actor gets stopped by a platform I CAN jump up but not over the platform. Its acting like the linear velocity x has been disabled on collision.

    Here are my Actors Attributes...

    [Motion Linear Velocity X = 200] (Move actor right)

    [Accelerate direction 270 relative to scene with acceleration 2000] (Gravity)

    [Bounce when colliding with actor tag Solid] (Actor collides with platforms)

    [IF: Actor overlaps or collides with tag solid]
    [DO: Change attribute self.jumpcount to 1]

    [IF: Key press space is down & if self.JumpCount = 1]
    DO: Set self.motion.linearVelocity to 600 & set self.JumpCount to 0] (Make Player Jump)

    [Control Camera] (Camera)

    Here is a screenshot:

    As you can see the actor moves across the screen hits the platform and stops. Then when you try to jump over the Motion Linear Velocity X = 200 does not work :/

    Any ideas???

  • JodyMitomaJodyMitoma Member Posts: 307

    Because the velocity has been stopped by a solid object... You'll need acceleration or something to keep it moving, otherwise, you'll have to make it so that the actor "dies" when hitting an object. I thought the objective was to not hit any walls? I'm not sure how you'll get this working, as I am doing something a little different. My apologies!

  • andrewpullosandrewpullos Member Posts: 2

    Hi all

    After some trail and error I have figured out how to do this.

    Rule when actor overlaps or collides with actor with tag solid

    Do: Change Attribute self.motion.linearVelocity to 200

    ELSE: Change Attribute self.motion.linearVelocity to 200

    Hope this helps anyone who was stuck like me.

Sign In or Register to comment.