Also, instead of making a maximum speed, make a maximum effort variable, and weigh it against air drag, water drag, and ground drag (ouch). What I am wondering is how to avoid spending hours putting things into a single sprite's if box to get many sprites that all must move to interact with every other sprite. That is a reason to want tags to tag sprites with, so each sprite of a certain type can be identified that way in IF blocks.
Oi! Still goes inside the walls. I have an idea for fixing this. Compose all the walls of one image, then underline it with four sprites for each of the four sides of each of the platforms or whatever in the project. Have everything lose or reverse velocity when hitting a certain wall side with a certain type of velocity, max 2 types of velocity of the 4 easily possible in Scratch. An example: the left sides of both the platforms would be one sprite, to make coding easy in limited Scratch progr.
I need some help cause I'm working on two games
Super Smash Bros Brawl 1
(1 cause theres gonna be more)
Sonic the Hedgehog
And the most imporant thing I've done so far is start preparing the Sprites (mainly costumes for the Sonic game.)But help is needed cause I downloaded this project (should of put it on my flash drive , so I have help to refer to , but I didnt.)
So leave a comment on my New World Man project , for some help and what you think of it.Thanks , later : ]
I have a question for you. Let's say you had 2 Cat sprites. How could you get them to bounce off each other as if they were solid? I've got some ideas, but everything I've tried doesn't quite work out the way it should.
Thanks for writing this. I refer to it all the time. I've used these formulas in my latest (link to project) and another project that I'm helping someone else write.
Great seeing you trying to teach people. Any change you could explain why the use of abs? what diffrence does it make to the script?
Slightly off topic, but what's you NG user, so i could view some of your movies
Sweet movement! the programming seems to be very afficient and there are only 2 glithches that I could find. Going through the ground and getting stuck in the area where the ground isn't.
exactly the same, but instead of changeing the X and Y, change the scroll X and Y (may need to use something like *-1 t change it to a negative number)
HELP! i have looked really carfully and made sure my script is JUST like yours, but my character always slides to the right without stopping unless i hole down the left arrow, which of course makes him move to the left. so jumping and left movement are fine but not the right one, could you help?
The purpose of the abs block is this is simple as well. Since the xVelocity can be a negative number if you want to move the sprite to the left using if (xVelocity>maxVelocity) is no longer an effective way to limit the sprite's movement. To fix this we make sure that the xVelocity variable is always positive.
I already said what it does. Ok, let me give you an example. Say we use abs on the number -5. It would look something like this abs(-5). Abs(-5) is equal to five. Abs(5) is also equal to five. Really simple concept once you understand it.
I am currently making a side-scrolling game and I need help beacuse with the X velocity value, the player sprite moves and extremely fast speed and hides into nowhere, even though the script is exactly the same. Can anybody help, please?
This project uses a efficient sprite movement script that would be good to use in your own projects.
You can put the scripts you see the background into scratch yourself or you can download the project.
The downloaded project includes comments that explain the script.
Comments
You need to be logged in to post comments
Add a Comment
Hey, where can I download 1.2?
This is an amazing and epic project. YAY!
Archmage! You have the old comment block!
I got stuck in the black platform.
sweet!
AWESOME! Thanks! And Scratch Jr is a GREAT project!!!
You really are the most talented guy in scratch. :)
Good to know :)
Nice... may be I need it one day...
wow.thats....cool!.
MY FREAKING SPRITE WONT MOVE LEFT OR RIGHT WITH THESE SCRIPTS!
Wait but now I removed the and and the abs of xvelocity and deleted max speed and now it works good!
how do you add comments?
the sprite goes right into the ground. any way to prevent that?
Yes, see my other project sprite movement done perfect.
This REALLY helps, but what if I don't want to be able to go through black?
see perfect sprite movement
Also, instead of making a maximum speed, make a maximum effort variable, and weigh it against air drag, water drag, and ground drag (ouch). What I am wondering is how to avoid spending hours putting things into a single sprite's if box to get many sprites that all must move to interact with every other sprite. That is a reason to want tags to tag sprites with, so each sprite of a certain type can be identified that way in IF blocks.
Try asking in the forums
Oi! Still goes inside the walls. I have an idea for fixing this. Compose all the walls of one image, then underline it with four sprites for each of the four sides of each of the platforms or whatever in the project. Have everything lose or reverse velocity when hitting a certain wall side with a certain type of velocity, max 2 types of velocity of the 4 easily possible in Scratch. An example: the left sides of both the platforms would be one sprite, to make coding easy in limited Scratch progr.
Here is a more advanced version that has what you are looking for. (link to project)
And how do you make sprites solids ?
What does the "abs" mean under the numbers category , cause sitting here saying "WTH does abs mean"?
I need some help cause I'm working on two games Super Smash Bros Brawl 1 (1 cause theres gonna be more) Sonic the Hedgehog And the most imporant thing I've done so far is start preparing the Sprites (mainly costumes for the Sonic game.)But help is needed cause I downloaded this project (should of put it on my flash drive , so I have help to refer to , but I didnt.) So leave a comment on my New World Man project , for some help and what you think of it.Thanks , later : ]
I have a question for you. Let's say you had 2 Cat sprites. How could you get them to bounce off each other as if they were solid? I've got some ideas, but everything I've tried doesn't quite work out the way it should.
Thanks for writing this. I refer to it all the time. I've used these formulas in my latest (link to project) and another project that I'm helping someone else write.
you need to do it on one point three.PLZ I IS BEGGIN NOW!!!!
Just copy the scripts in the background.
what the heck is that, cds56?
good. theres no wall sensing. thebirdisthewordthebirdistheword wallsensingisthewordwallsensingisthewordwallsensingistheword
never mind about the ABS.
My brother has abs! :D XD
(view all replies)Great seeing you trying to teach people. Any change you could explain why the use of abs? what diffrence does it make to the script? Slightly off topic, but what's you NG user, so i could view some of your movies
I don't have a lot of stuff on ng my user is archmage-flash
Wow. I made sprite movement like this with velocity, but this is much better and more elaborate than mine. Did you use Flash to make this?
I made it in scratch. In the background you can see the programming.
(view all replies)Sweet movement! the programming seems to be very afficient and there are only 2 glithches that I could find. Going through the ground and getting stuck in the area where the ground isn't.
It's not completely done right. You can get stuck in the block.
It is the best you can do with a single sprite. I think you may prefer this one (link to project)
(view all replies)Archmage, We Have An Emergency, Please Come To This Chatbox, It's Scrolling Problems : http://javascriptrpg.webs.com/Gaming.htm
also how would you do this with scrolling
exactly the same, but instead of changeing the X and Y, change the scroll X and Y (may need to use something like *-1 t change it to a negative number)
can you tell me how to double jump
Sorry . . . can u tell me how to flip a sprite?
I don't get how people can get the sprites look just like the scripts. HOW DO THEY DO IT? Please reply and tell me the answer
you do it on the script area. not the script.
YOU RIGHT CLICK (or ctrl click) AND THEN CLICK "SAVE PICTURE OF SCRIPTS".
(view all replies)Wow. How do you invent this stuff!? It's amazing!
I programmed this before in flash
(view all replies)HELP! i have looked really carfully and made sure my script is JUST like yours, but my character always slides to the right without stopping unless i hole down the left arrow, which of course makes him move to the left. so jumping and left movement are fine but not the right one, could you help?
I know. you need to put POINT Zero Nine 0.9. under set xvelocity x 0.9. rember, 0.9 not 9. hope this helps! :)
If all else fails, just download this project and export the main sprite. Then import the sprite into your own project.
(view all replies)The version doesn't matter. If your project acts diffrently than this one it is because your script is diffrent.
(view all replies)You did something wrong. Make sure that all the numbers are correct.
(view all replies)hey, so you made the scratch lessons on wikibooks?
look what i did with your moving script archmage!!!! (link to project)
hey why do you have to make a variable maxspeed if its forever 20. Can't u just do (if abs of xvelocity< 20)
you might also want to change it so that you can like make a speed round or something
It's easier to change if its a variable.
(view all replies)archmage do u mind if i use this in my project I'm not good with gravity and all that stuff Thanks!
I put it here for people to use :)
(view all replies)THanks Rchamge, I thought I would say thanks as you taught me how to scroll aswell, thanks for being helpful!
Being helpful is what I do :)
ABS is the absolute value of something.Or i think
You are correct
I also want to know what "ABS" means
The purpose of the abs block is this is simple as well. Since the xVelocity can be a negative number if you want to move the sprite to the left using if (xVelocity>maxVelocity) is no longer an effective way to limit the sprite's movement. To fix this we make sure that the xVelocity variable is always positive.
I already said what it does. Ok, let me give you an example. Say we use abs on the number -5. It would look something like this abs(-5). Abs(-5) is equal to five. Abs(5) is also equal to five. Really simple concept once you understand it.
what does "abs" mean/do?
It makes numbers positive.
(view all replies)U ROCK!!!!!!!!!!!!!!!!
some one please tell me how you can download it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
how do you download it??
Look to the right of the project.
(view all replies)BIG GLITCH I exactly copied the scripts at the back to Scratch....then it doesnt do anything! it onl jumps but horribly!
Oh it works now! I used it on my Space Wars game, almost out. Thanks alot =)
Or......are the scripts on the screen on the cat........
Yes, the scripts on the screen are on the cat.
I mean, you said there was help w/ JUMPING here, too.
Yes, the script in the background picture is for jumping and other movement.
Then what are the scripts on the cat(main sprite)?
Download the project to look at the scripts in the cat sprite.
(view all replies)I'm going to make a scratch project using the comment block from this project. I'll duplicate it and give you credit.
i dont get it
oh yeah from the old version of scratch
welcome.
no, they are variables. i get red variables, and i have version 1.2.
(view all replies)how did you get the red blocks!!!
IT WONT LOAD!!! very cool though!
i'll try
if, my bad. oh archmage? how uh, do you make shooting?
CHeck this out (link to project)
i it scrolls, just don't make an x velocity
I am currently making a side-scrolling game and I need help beacuse with the X velocity value, the player sprite moves and extremely fast speed and hides into nowhere, even though the script is exactly the same. Can anybody help, please?