0 Favourites

Auto Start movement at load?

  • I can't seem to figure this out and I'm sure it's simple. I've searched the forums but my searching is in vain.

    Here is what I'm looking to do:

    Start my character moving from left to right, across the screen at a set speed (70 in this case) with the gravity and other attributes that go with a platform behavior. When it hits a solid, I'm going to have it start the other direction. The user does not control the character, they will be interacting with other objects on the screen to influence the movement of the character.

    At first, I was all 'Bullet'! because I can start it in 1 direction then it bounces off the walls but the bullet has flaws. It either bounces constantly on the ground as it moves forward or falls through solids :(

    Then I was like 'Platform'! and I told it to simulate the Right key at every tick and block input from the user, but then the character does not turn when he hits a solid wall.

    I tried combining the two but it just falls off the map.

    What am I missing?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Use Platform behavior and try something like this;

    This assumes you have a side-view character facing right by default.

    a) Simulate press left if Player is mirrored

    b) Simulate press right if Player is not mirrored

    c) When the Player hits a wall switch between mirrored and not mirrored.

  • <img src="http://www.scirra.com/forum/smileys/smiley32.gif" border="0" />

    Thanks for the advice. I tried a few ways of doing it and this is the one that worked; I created an instance var bool, called 'flip' starting at false. I then did this:

    1) System > every tick >

    > 2 char > is flip > char > Simulate Platform pressing left

                          > char > Set Mirrored

    > 3 char > X is flip > char > Simulate Platform pressing Right

                          > char > Set Not Mirrored

    4) char > Platform On stopped > char > Toggle flip

    It now does exactly what I wanted! Of course, I'll need to add in the code to block input but above are the parts that count.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
233 22,244
TiAm's avatar
TiAm
Unread hot topic
0 Favourites
Path Movement Behavior
98 52,469
R0J0hound's avatar
R0J0hound
Unread hot topic
52 8,561
BluePhaze's avatar
BluePhaze