Newer tutorials: Testing if something is a string or a number. (12-Feb-19)
INTRO: This is the first of a series of step-by-step tutorials made for anybody who needs help with their projects, either to make them or to increase their quality. These tutorials also help inspire new projects and new ideas. Lastly, these tutorials take advantage of the fancy new forum blocks made by JSO. Enjoy!
Wall Jumping
NOTE: This method does not work for scrollers.
Step 1: Make three variables.
(xv) (-xv) (yv)Step 2: Make a sprite that looks like this:
when flag clicked forever go to [sensor v] //The name of your other spriteStep 5: Make two scripts in the sensor sprite.
when flag clicked set [xv v] to [0] set [-xv v] to [0] forever set [ghost v] effect to (100) if <key [right arrow v] pressed?> //Or the key to press to move right change [xv v] by (1) //Adjustable - makes the character move faster/slower end if <key [left arrow v] pressed?> //Or the key to press to move left change [-xv v] by (1) //Should be the same as the moving right speed end if <key [up arrow v] pressed?> //Or the key to jump if <color [#0000FF] is touching [#000000]?> //Substitute black with ground color for all. set [yv v] to [20] broadcast [jump v] end end if <not <color [#0000FF] is touching [#000000]?>> change y by (-5) end if <color [#FF0000] is touching [#000000]?> set [yv v] to [0] set [xv v] to [0] if <<not <color [#0000FF] is touching [#000000]?>> and <not <key [up arrow v] pressed?>>> wait (0.5) secs if <key [up arrow v] pressed?> set [yv v] to [20] broadcast [jump v] end set [-xv v] to [10] end end if <color [#00FF00] is touching [#000000]?> set [-xv v] to [0] set [yv v] to [0] if <<not <color [#0000FF] is touching [#000000]?>> and <not <key [up arrow v] pressed?>>> wait (0.5) secs if <key [up arrow v] pressed?> set [yv v] to [20] broadcast [jump v] end set [xv v] to [10] end end change x by (xv) change x by ((0) - (-xv)) change [xv v] by ((xv) * (-0.2)) change [-xv v] by ((-xv) * (-0.2))And one for jumping:
when I receive [jump v] repeat (10) if <color [#FFFF00] is touching [#000000]?> set [yv v] to [0] stop script end change y by (yv) change [yv] by (-1) end set [yv v] to [0]You're done!
Last edited by 360-International (2012-02-19 20:11:00)
Offline
This is a good guide
Offline
Instead of rewriting it, you might just want to link to the wiki article.
Offline
Offline
nickbrickmaster wrote:
Instead of rewriting it, you might just want to link to the wiki article.
Yes, but this way, I can pool ideas from other Scratchers to improve the script. In the wiki, you can't unless you have a wiki account, which in turn are granted only if you have a legitimate reason for being a wiki editor.
Offline
when [wall jumping tutorial v] clicked if <[mood=yes v]> read guide broadcast [guide read] if <[mood=no v]> click [go back one page v] button
When I receive [guide read v] think [what a great guide!] repeat until [better guide read] say [that guy's guides rock!] end if [better guide read v] think [what a great guide!] say [that guy's guides rock!]
Offline
when [wall jumping tutorial]clicked broadcast [awesome]
Offline
littlebird2472 wrote:
when [wall jumping tutorial]clicked broadcast [awesome]
when I receive [awesome v] say [Thanks!!] for (54) secs
Offline
Great tutorial.
Offline
It does not work. I did everything you said.
Last edited by Nomolos (2012-09-27 11:29:47)
Offline
I stick to walls and don't wall jump
Offline
360-International wrote:
littlebird2472 wrote:
when [wall jumping tutorial]clicked broadcast [awesome]when I receive [awesome v] say [Thanks!!] for (54) secs
Isn't this block spam? Anyway trying it out!
Offline
I like the way you make the character just an avatar for the sensor that really does all the work. That's how the professionals do it.
Offline
What does -xv do???
Offline
awesomeness321 wrote:
What does -xv do???
Its a variable. It holds value that can be used for manipulation later in the script.
If you look at the scripts, it's just a shortcut, you use it instead of inputing a negative into the xv variable. It has its ups and downs in comparison to the traditional negative way.
Offline
henley wrote:
awesomeness321 wrote:
What does -xv do???
Its a variable. It holds value that can be used for manipulation later in the script.
If you look at the scripts, it's just a shortcut, you use it instead of inputing a negative into the xv variable. It has its ups and downs in comparison to the traditional negative way.
I meant that the scripts didn't show it doing anything other than changing it's number. xv and yv changed x position and y position, but in this script, -xv doesn't do anything.
Offline
Your missing a step in your tutorial. You have to make the walls and ground. The sensor is moving until it hits the color black. If there is no black color to hit nothing happens, except the variables change. Simple scene, make a black rectangle sprite and put your sensor inside it.
Offline