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

#1 2012-07-01 10:30:57

caketin92
New Scratcher
Registered: 2012-07-01
Posts: 1

HELP i need to make my sprite move and jump properly

Basically i am making a mario type game and i want my sprite to move and jump to the left and the right without being really jerky and i want it too be smooth. I also want to know how if i jump ontop of a box that i stay on there and no go back to the ground . Please help.

Offline

 

#2 2012-07-01 11:06:00

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: HELP i need to make my sprite move and jump properly

Simplest way for collision would be colour sonsing, and for good movement use velocity.

when gf clicked
forever
if <key [right arrow v] pressed?>
if <(xvel) < (maxspeed)>
change [xvel v] by (13)
end
end
if <key [left arrow v] pressed?>
if <(xvel) > ((maxspeed)* (-1))>
change [xvel v] by (-3)
end
end
if <key [up arrow v] pressed?>
set [yvel v] to (-5)
wait until <touching (ground colour)?>
end
if <<not<touching (ground colour)?>> and <(yvel) = (0)>>
change [yvel v] by (-2)
end
if <<touching (ground colour)?> or <touching (colliding colour)?>>
set [yvel v] to (0)
end
change x by (xvel)
change y by (yvel)
set [xvel v] to ((xvel) * (0.87))
set [yvel v] to ((yvel) * (0.87))
EDIT: For a scroller you'd just change scrollx instead of x positions

Last edited by zammer990 (2012-07-01 11:35:47)


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

Board footer