Gravity and some events aren't working.

For questions about using Classic.

Post » Mon Dec 21, 2009 9:22 pm

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.
?When everyone feels hope at the same time, wonderful things can happen.
B
5
G
3
Posts: 67
Reputation: 1,059

Post » Mon Dec 21, 2009 10:56 pm

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
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Mon Dec 21, 2009 11:03 pm

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:

[code:3ezucw28]
+ 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 :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Dec 21, 2009 11:08 pm

Thank you so much, it seems like I have fool troubles and then you look and fix it very easy haha, I'm foolish :oops:
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.
?When everyone feels hope at the same time, wonderful things can happen.
B
5
G
3
Posts: 67
Reputation: 1,059

Post » Mon Dec 21, 2009 11:20 pm

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.

[code:39zuq7zz]
+ 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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Dec 21, 2009 11:42 pm

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.
?When everyone feels hope at the same time, wonderful things can happen.
B
5
G
3
Posts: 67
Reputation: 1,059

Post » Tue Dec 22, 2009 12:20 am

Hi again.

I've posted my Platform Engine here - viewtopic.php?f=16&t=5316 - 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.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Tue Dec 22, 2009 12:33 am

[quote="Carlos182":ltktjvpk]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.[/quote:ltktjvpk]

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 :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Dec 22, 2009 12:38 am

[quote="deadeye":1netypzg][quote="Carlos182":1netypzg]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.[/quote:1netypzg]

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 :P[/quote:1netypzg]

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


I never played Mega-man, lol.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Dec 22, 2009 2:00 am

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests