This site requires JavaScript, please enable it in your browser!
Greenfoot back
SWAG
SWAG wrote ...

2013/5/18

SWIMMING HELP - Urgent

SWAG SWAG

2013/5/18

#
Can someone help me fast. My final project is due Monday. How can I get my player to swim. I want him to slowly swim up when presses the "a" and if he's not pressing the button he is slowly coming down. And when is walking on the bottom of the ocean he should move really slow.
Gevater_Tod4711 Gevater_Tod4711

2013/5/18

#
Therefore you have to know when he is in the ocean and when he is not. The rest should be easy. To know that you somehow need to recognice where the ocean is. Maybe you can do it like in this examples: Gravity Engine Operation: Crash Test Or maybe there is an easyer way for doing that in your scenario. But therefore it would be very helpfull to know how your scenario is built up. (Do you use objects for the ocean?, Is there a scrolling world?...)
SWAG SWAG

2013/5/18

#
Gevater_Tod4711 wrote...
Therefore you have to know when he is in the ocean and when he is not. The rest should be easy. To know that you somehow need to recognice where the ocean is. Maybe you can do it like in this examples: Gravity Engine Operation: Crash Test Or maybe there is an easyer way for doing that in your scenario. But therefore it would be very helpfull to know how your scenario is built up. (Do you use objects for the ocean?, Is there a scrolling world?...)
The whole map is water I want to know how can I make a the character swim. So when presses a he's swiming upward at a slow speed (less then 1)
SWAG SWAG

2013/5/19

#
SWAG wrote...
Can someone help me fast. My final project is due Monday. How can I get my player to swim. I want him to slowly swim up when presses the "a" and if he's not pressing the button he is slowly coming down. And when is walking on the bottom of the ocean he should move really slow.
I Need help FAST
JetLennit JetLennit

2013/5/19

#
perhaps importing the smooth mover class will help?
Gevater_Tod4711 Gevater_Tod4711

2013/5/19

#
For a smooth movement you just need to use double values instead of int values for the location of the players. If you have a look at the class Player in Operation: Crash Test you'll find what you need. Just use the class Player as the superclass and it should work.
You need to login to post a reply.