Hey,
Im struggling with creating a slide movement for my Actor.
Im using the basic SmoothMover class that you can Import and found this piece of code created by Super_Hipp @/topics/8306/0
v is a private double = 0 , but in the game it does not work. I checked that v does not get changed at any time which make me wonder.
Thanks for youre help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | if ( World.gamemode == 3 ) { if (Greenfoot.isKeyDown( "enter" )) { Wold.playerspeed = 800 ; } if (Greenfoot.isKeyDown( "Up" )) { if (v< 0.9 ) {v+= 0.1 ;} else {v = 1 ;} } if (Greenfoot.isKeyDown( "Down" ) && getY() < 450 ) { if (v>- 0.9 ) {v-= 0.1 ;} else {v =- 1 ;} } if (v> 0.1 || v<- 0.1 ) {move(v); v*= 0.95 ;} else {v= 0 ;} } |