Gravity and some events aren't working.

This forum is currently in read-only mode.
From the Asset Store
Gravity Square is a game where I aim to reach the square at the polka dot door :)
  • Hi, well I have some troubles with the engine I'm making, the first one, is the Air Acceleration/Decceleration, I had 0 and 0 in that values but then I realized 2 things, my player can not move when is on air, and second, if I jump to the right, and then release the Right Arrow, the player kept falling towards right, and I dont want that.

    So I inserted some random values, trying to get a normal jump acceleration and decceleration, but I couldn't. The values always makes my player moves too fast, I don't know a better values, so please, if you can fix that, I would be glad.

    The events that are not working are in the WallSliding sheet. You know, Megaman X can slid in walls, so I made this Tile blocks, and had this events:

    When Player is overlapping the Tiles, has a wall on the right, and Key Right Arrow is pressed, modify the gravity to 20. If Player is overlapping the Tiles, has a wall on the right but the Key Right Arrow is not pressed, set the gravity to normal. But the problem is when I press Right again... the gravity doesn't go 20 again, it remains in the original value.

    Here are the .cap file: http://www.megaupload.com/?d=3FJ9Q4UC

    I hope you can help me, I'm using 0.99.6 version, thanks!!,

    Carlos.

  • For the wallslide I wouldn't change the gravity value, instead I'd modify the Y vector (y movement) of the platform object.

    Modified cap here - http://dl.dropbox.com/u/1646976/wallslide.cap

  • If you want your player to accelerate instantly to max speed when you start moving, with no inertia, then just set all of your acceleration and deceleration values to higher than your max speed.

    Anyway, if you want a wall slide while pressing against a wall, then try this:

    + Always
        -> Set Max Fall Speed to normal
    
    + Player is falling
        + Player is overlapping wall at offset (2, 0)
        + Control "Move right" is down
            -> Set Max Fall Speed to something low
        + Player is overlapping wall at offset (-2, 0)
        + Control "Move left" is down
            -> Set Max Fall Speed to something low
    [/code:3ezucw28]
    
    You don't really need to mess with the gravity in this case.
    
    Heh, Minor beat me to it but I'm posting this anyway
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much, it seems like I have fool troubles and then you look and fix it very easy haha, I'm foolish

    Also, if you can, please teach me how to make a Timer because I tried so many times, like creating an object with timer behavior or others, but I can't. I want to start the timer when the player press the Dash button, like 1 second long, then when the timer stops, the player will stop dashing even if the Dash button is still pressed (remember that I move the X vector position when Dash button is pressed).

    Thanks again,

    Carlos.

  • I just took a look at the .cap you posted. Just a heads up, you don't really need those red X sprites to check for overlap. You can get rid of them. Just use the overlap at offset like I showed. Alternatively you could use "Has wall to left or right" in the Platform Behavior conditions.

    As for a timer, you could do that with Every X Milliseconds and a variable to store your timer information.

    + Press Dash
    + timerVariable is equal to 0
        -> Set timerVariable to 2
    
    + timerVariable is greater than 0
    + Every 1000 milliseconds
        -> Subtract 1 from timerVariable
    [/code:39zuq7zz]
    
    The reason you would set it to 2 is because "Every X Milliseconds" triggers instantly the first time it's encountered, so it subtracts 1 right away.  Then it waits 1000 milliseconds, which is one second, and subtracts again.  Then your timerVariable is 0.
    
    That way you can use timerVariable in conditions.  "Compare private variable" or "Compare global variable" can be used to see if the timer is active or not by checking if it is greater than or equal to 0.
    
    Alternately, you could set your timerVariable to 1, and subtract 1*timedelta.  Either way would work.  If that's the case then you would need to change your "timerVariable = 0" conditions to "timerVariable is less than or equal to 0" because you might skip over 0 entirely.
  • The reason I use those RedSprites is because I don't want Megaman to slide in every wall, just on some (like the original game).

    Anyway, I will check the thing of the timer, thanks for the answers. You've been very helpfully =)

    Thanks,

    Carlos.

  • Hi again.

    I've posted my Platform Engine here - - if you want to take a look at it.

    It probably has the features in a Megaman game and might help you out along the way.

    And hopefully is commented well enough.

  • The reason I use those RedSprites is because I don't want Megaman to slide in every wall, just on some (like the original game).

    Anyway, I will check the thing of the timer, thanks for the answers. You've been very helpfully =)

    Thanks,

    Carlos.

    Really? He can only slide on some of the wall but not all of them? That's weird... I don't remember any such restriction. Of course, it's been a long while since I played those games.

    Seems odd to me that if you have wall sliding, you wouldn't just allow the player to slide on whatever wall they wanted to. But hey, whatever

  • > The reason I use those RedSprites is because I don't want Megaman to slide in every wall, just on some (like the original game).

    >

    > Anyway, I will check the thing of the timer, thanks for the answers. You've been very helpfully =)

    > Thanks,

    > Carlos.

    >

    Really? He can only slide on some of the wall but not all of them? That's weird... I don't remember any such restriction. Of course, it's been a long while since I played those games.

    Seems odd to me that if you have wall sliding, you wouldn't just allow the player to slide on whatever wall they wanted to. But hey, whatever

    Rocky walls, irregular looking walls, walls covered in ACME self sticking none stick surfacing.

    I never played Mega-man, lol.

  • Ah. Even so, you still don't need those extra objects. You could give each of your slidey walls a "Slide" attribute and use Overlapping at Offset to check that you're next to that attribute. Or make a family called "Slide" and stick all of your slidey walls into it. Either way, having a bunch of extra sprites hanging around like that is pointless. It just clutters up your layout.

  • Yeah, believe it or not in some areas MegamanX can't use wall sliding, I'm 100% sure.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)