I have made a basic platform game, and i was wondering if there is any way to my my character swim when in water.
This would mean slowing him down whilst touching a certain shade of blue (water) and not being able to jump as high.
to see the game i wish to add this feature to go here:
http://scratch.mit.edu/projects/Corwen/2630226
please help!
Offline
I haven't seen your game but try making these two scripts like these:
when gf clicked forever if <touching colour [#00FF00]?> move [-5] steps //or however much you want to slow down by. Drawback is if you stop moving you get dragged back again. end
when gf clicked point in direction [-90 v] move 10 steps This is just a bit of a guess, and I don't know about the jumping, but it might work!
Offline
zammer990 wrote:
Make your movement scripts work on variables (speed or velocity) and then just have if touching blue set speed to (smaller amount) else set speed to (normal)
Thanks for the reply, i will test this next time i am working on my game. I am almost certain it will work
Offline
For moving left and right:
when gf clicked forever if <touching colour [ground colour] if <key [right arrow] pressed> change x by 5 end if <key [left arrow] pressed change y by -5 end end if <touching colour [water colour] if <key [right arrow] pressed> change x by 3 end if <key [left arrow] pressed change y by -3 end end endFor jumping:
when gf clicked forever if <<touching colour [ground colour]> or <touching colour [water colour]>> set [y velocity] to (0) end if <<touching colour [ground colour]> and <key [up arrow] is pressed>> change [y velocity] by (15) end if <<touching colour [water colour]> and <key [up arrow] is pressed>> change [y velocity] by (9) end if <<<not <touching colour [ground colour]> or <touching colour [water colour]>>> change [y velocity] by (0.4) end end[scratchbocks]
Offline