0 votes

[Godot 3.2 or 3.4.4 windows 10 ]
https://www.youtube.com/c/BornCG/playlists (Godot 3 tutorial series)
I am making a platformer game so I would like to make it so that the player is walking on the platform comes to a water section (swims across ) then walks on the next platform
(and maybe while under water collects coins etc.)

Godot version 3.2 or 3.44
in Engine by (52 points)

2 Answers

0 votes

Sorry if this feels harsh but it is not the intent. You are not really asking anything. Try to be more specific and tackle one problem at a time. For example, what do you want "swimming" to be in your game? do you want the character to be able to move in all directions under the water?, do you want it to be still when no input is detected? do you need help with detecting when the player is in the water, in order to change some animations?

I could go on, but there is tons of stuff that could be done. So tell me, and I will try to help!

by (418 points)

Lets try this
character walks across platform hits water swims to the other platform and then walks across it etc..

while in the water the character can look for and collect coins etc.
if the character dose not swim he sinks to the bottom (the character dies.)

if he is in the water for more than 5 min he dies

Again sorry but too broad of a question. I am telling you this, so in the future you can get better awnsers. I dont know how much you know, and with what you need help, and of course i cant write you the whole code of everything you want as I envition it.

For example, collecting coins. What do you need help with there? Do you know about area detection, queue_free, saving score in a var?

Another thing, why is it important that the player starts and ends on a platform in your question. do you need help with the transition? like when the character is close to the border to have a climbing animation?

I would sugest that you just start by making the player to move in the water. You need to first know, when the player is ocupying water. To do this I would suggest having an Area2d on the water that sends a signal to the player when the player enteres and exits the area. Once that is done, write a var in the player called swimming that becomes true or false when recieving this signals. Then in the movement code, check if player is swimming, and do the correct changes. This includes a lower gravity value, and the ability to go upward.

0 votes

I would just use a weaker gravity than whatever you're using while the character is on land. And I'd use a position vector, like an anchor... And, then have a script make the character rise if it goes too far below the position vector and then fall if it is too far above. If you use small numbers it should appear as the character is bobbing up and down.

The rest of the stuff, should be pretty similar to platform direction control and item detection, etc. ... I'm assuming you've got that part...

by (169 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.