I need the simplest script that would allow me to create a simple platformer game in which a skater will go left/right when left/right arrow is clicked and will go up/jump the ramp when the he is touching it.
I was thinking of using "is touching color" blocks to detect ground/ramp collision. Can someone suggest a project in which such scripts are already present?
Offline
I cannot give you a project right now that uses something like this, but you can add 'hit' sprites which can be used to detect whether the player is on a ramp or flat ground. For example if touching the ground and touching on the right then you need to slide downwards left.
I will try and find a project which uses this but you may need to mess around with things like that:)
Offline
This may not be too useful but to get a grasp of player reactions to a ramp http://scratch.mit.edu/projects/AtomicBawm3/2184464 might be useful. It shows how a slope can be detected. In your project you won't want the bounce effect but when the ramp orientation has been determined then you can react accordingly. Hope this helps a bit, I can find nothing more relevant at the moment.
Offline
I guess if you don't want to use a sensor sprite, you can use different colored walls. Maybe something like this?
when flag clicked set [xv v] to (0) set [yv v] to (0) forever change x by (xv) change y by (yv) set [xv v] to ((xv)*(0.96)) // slow down speed (friction) if <key [left arrow v] pressed?> change [xv v] by (-1) //movement speed end if <key [right arrow v] pressed?> change [xv v] by (1) //movement speed end if <touching color [#00FF00]?> //color of wall set [xv v] to ((xv)*(-1)) end if <touching color [#FFFF00]?> //color of normal ground set [yv v] to (0) else change [yv v] by (-0.5) //speed of falling down (gravity) end if <touching color [#0000FF]?> //color of ramp set [yv v] to (15) //jumping force end endIf you don't want the things to be such a different color, you can make them almost the same.
Offline