This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-29 15:27:45

bdn7
Scratcher
Registered: 2010-07-10
Posts: 100+

Water Physics

I am making a scroller/animation/RPG and I need help making physics for a person in water. I want them to float on the water when nothing is pressed and sink when the down arrow is pressed, but float back up when it isn't. Also when you jump off a heigh height the person should sink, and then float to the surface. PLEASE HELP!!!


http://i.imgur.com/Q7PiV.png
That's right. My text is BLUE.

Offline

 

#2 2011-01-29 19:11:52

HydraRancher
Scratcher
Registered: 2010-03-07
Posts: 9

Re: Water Physics

Well I'd first start with a simple float.

Code:

When Green Flag is Pressed
   Forever
      If Touching Colour Blue
         Then
            Change Velocity by 0.1
          Else
            Change Velocity by -0.1
      Change Y by Velocity

So this will make your sprite bounce about. Then, you do as follows:

Code:

When Green Flag is Pressed
   Forever
      If Down Arrow is Pressed
         Then
            Change Velocity by -5
            Wait 0.2
          Else

So now the down arrow decreases Velocity by -5

For jumping, it really depends on your jump system.

Offline

 

#3 2011-01-29 22:32:41

bdn7
Scratcher
Registered: 2010-07-10
Posts: 100+

Re: Water Physics

HydraRancher wrote:

Well I'd first start with a simple float.

Code:

When Green Flag is Pressed
   Forever
      If Touching Colour Blue
         Then
            Change Velocity by 0.1
          Else
            Change Velocity by -0.1
      Change Y by Velocity

So this will make your sprite bounce about. Then, you do as follows:

Code:

When Green Flag is Pressed
   Forever
      If Down Arrow is Pressed
         Then
            Change Velocity by -5
            Wait 0.2
          Else

So now the down arrow decreases Velocity by -5

For jumping, it really depends on your jump system.

Thanks that should work well!


http://i.imgur.com/Q7PiV.png
That's right. My text is BLUE.

Offline

 

#4 2011-02-05 06:56:41

skeletonxf
Scratcher
Registered: 2010-11-02
Posts: 10

Re: Water Physics

<when green flag clicked>
<forever>
<set{ Y velocity }to(( Y velocity <*> 0.98 ))

That will apply frioction and stop the sprite moving to fast

Offline

 

#5 2011-02-20 14:50:20

-GizzardGulp-
Scratcher
Registered: 2010-03-05
Posts: 100+

Re: Water Physics

skeletonxf wrote:

<when green flag clicked>
<forever>
<set{ Y velocity }to(( Y velocity <*> 0.98 ))

That will apply frioction and stop the sprite moving to fast

are you trying to sound all complicated or something because that won't really change anything


http://i1118.photobucket.com/albums/k607/Max_Levine/SnoutmolStudios.png

Offline

 

#6 2011-02-20 14:55:25

TVflea
Scratcher
Registered: 2010-08-14
Posts: 1000+

Re: Water Physics

go to my forums all about physics


-iNetMaster-'s not dead, get used to it. ! big_smile .
http://is.gd/YrQzXX

Offline

 

Board footer