Swimming

For questions about using Classic.

Post » Tue Jun 01, 2010 10:25 pm

So i have been trying to make swimming in my game, where instead of slowly sinking all the time, you float, and have to actively make yourself sink.

There are various options i have found that almost facilitate this.

I have it set at the moment, so that when you over lap the water detector thing, it changes the gravity direction, but this however rotates all the controls 180. So then i have it invert the controls. But invert doesn't change the jump direction. Which kills the effect.

I have tried setting gravity to a negative value, but that does not work.

Is there anyway to invert the jump direction? Or can anyone think of a better way to do floating in water?
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Wed Jun 02, 2010 7:20 pm

I think you what swimming like super Mario world.
anyway here is a cap to show you how to do it.

http://download953.mediafire.com/zsil2w ... imming.cap
just press X key to jump and swim up.
hope this help you out.
B
21
S
4
G
4
Posts: 280
Reputation: 2,934

Post » Wed Jun 02, 2010 7:46 pm

Very slick demo toralord
B
28
S
8
G
8
Posts: 530
Reputation: 7,149

Post » Thu Jun 03, 2010 8:39 am

[quote="toralord":20b1001i]I think you what swimming like super Mario world.
anyway here is a cap to show you how to do it.

http://download953.mediafire.com/zsil2w ... imming.cap
just press X key to jump and swim up.
hope this help you out.[/quote:20b1001i]I believe he wanted to actively swim downward... floating until the user presses button X.
B
14
S
2
G
5
Posts: 37
Reputation: 2,777

Post » Thu Jun 03, 2010 9:31 am

I'd suggest making it a form of a reverse jump (though not reversing gravity)

When the character is in water, move him upwards constantly unless he is at the surface, and when the player presses [whatever], move him downwards again. Either make the downwards movement stronger than the constant upwards movement or disable the upwards movement while the character is diving.

Alternatively, you could make the swimming controls be 8 directional movement instead.

-Player is in water
-Player control "swimbtn" is down
----+Deactivate Platform behaviour
----+Activate 8 Direction behaviour

and of course move him upwards whenever he's in water and not holding "swimbtn" down.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Thu Jun 03, 2010 11:31 am

I represent you the ultra realistic water dynamics:
[url:gteylvnn]http://www.box.net/shared/u4qbeqqeap[/url:gteylvnn]
By modifying players [Platform].VectorY movement you can get that soft movement you might want. I would probably use some detectors on the surface or some else way control that player doesn't accelerate too much when he's going upwards.
B
3
G
3
Posts: 15
Reputation: 905

Post » Thu Jun 03, 2010 7:26 pm

Hey thanks guys :)

I have not been idle, and have come up with 4 or 5 different methods that almost get what i want, the closest one is so, so, so close, but a weird bug pops up in one place.

I don't know how much time i have this weekend. I am working the whole public holiday weekend, and my parents will be in town. But i will be trying to incorporate what you chaps have suggested so far, and see if i can come up with something comprehensive.


SacceuS - Hey chap, very close to what i want, thanks! Where did you get this "Player[Platform].VectorY" from? I have not come across this in my travels.

InkBot - Very good ideas, one of my solutions was 8 direction, but not as elegant as you proposed. I will have to look into that aswell.

Partymetroid - Cheers for bringing that up, didn't want to rag on the only guy to offer help so far :/

Guyon - True!

Toralord - Cheers for the example man, unfortunately that is the sort of swimming i already have involved, want to reverse the situation! :)


Thanks guys, if i get anything going i will endeavour to make it tidy enough to post. I went to bed quite pissed off that i had not managed to succeed with this, especially with no real time to work on it coming up for a week or so. Was good to find some help this morning.
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Fri Jun 04, 2010 4:49 am

My bad I think I get what you are talking about.
So, player is floating on the surface, and have to actively make yourself sink and rise.
I made a new cap to show the kind of swimming you want.

http://download717.mediafire.com/nzy0jq ... ming+2.cap

Now the key controls are different then the my last cap.

When you are on land the platform behavior is normal.
press the X key to jump
press the arrow keys to move

when you are in the water the platform behavior changes.
Pressing the X key to jump will only work in the water when the player is at the top or the bottom of the water.
press the arrow keys to swim around.

P.S. I also made a reverse one to the one on top.
http://download277.mediafire.com/y0ibwm ... ming+3.cap

In this one the player always float up while in the water.
press the X key to jump while in water only work when at the top of the the water again.
press the left and right arrow keys to move
press the down arrow key to dive.
B
21
S
4
G
4
Posts: 280
Reputation: 2,934

Post » Thu Oct 04, 2012 10:42 pm

Is there a way to move it to Construct2?
B
84
S
30
G
22
Posts: 384
Reputation: 18,457

Post » Fri Oct 05, 2012 12:35 pm

You can't just copy paste from CC to C2, but the events are simple enough to recreate.Gelidaer2012-10-05 12:35:32
B
13
S
4
G
1
Posts: 63
Reputation: 1,170

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest