chickenmen - That's why I created this, to illustrate a method for background scrolling and character movement. Read the project notes and download the code to see how it's done.
after a while, you can stand in mid air. I think that is because there is one platform and you and I think you never put the repeat until touching color gree. But I might be rong. Pretty good!
Can I use some of your scripts for a scrolling background in a game I am making? It has nothing to do with Mario, it is about a lost kitten, but I need help with the scrolling background. Please?
There are probably better ways to detect where Mario can and cannot land. I'm doing it here with X/Y position detection. Unfortunately, that doesn't scale very well since you have to check all of them. Some sort of trigger would be better. Scratch really starts to slow down though, so I don't know if a complex game like Mario is truly possible.
The speed is highly dependent on your computer, probably your graphics card. Scratch lacks a timer, so there's no way to know how long a particular function takes so that you can even out the speed.
The floating thing is because only the first platform is programmed.
Added a Mario - he can jump to the first tower and fall. Note that you might need to restart a couple of times before you see Mario and the other moving characters - seems to be a layering bug.
What do you mean by "play" ? All it does it let you scroll around. If it isn't scrolling from within the browser, then click on the window and try again - it needs to have "focus" when in a browser. Otherwise, download the project and run it in Scratch.
Download "Mario"(18 sprites and 37 scripts) and open it in Scratch
Project Notes
Super Mario Bros scrolling background with moving and jumping Mario plus turtle and mushroom movement. Use the arrow keys to scroll.
Note that you may need to restart a couple of times to see the Mario and other characters - there seems to be a bug in the layering. Also, the mushroom movement isn't quite right in the browser, but it's fine within Scratch itself.
The trick to getting a good scrolling background like this is: 1) Use 480x360 sprites as your background images. 2) Since Scratch can't move them all the way off the screen, use two "border" sprites to make the screen narrow enough. 3) Offset the background image positions to overlay each other by the border width (18 pixels). 4) Layer the images. 5) Use a variable for all sprites to control their positions.
You'll see that once you set things up with the right size, positions, and the borders, the scripts to handle the scrolls are simple.
Handling character movement that occurs off-screen is a bit tougher, with some tricky calculations. Fortunately, most of the math is based on the scrolling background positions.
Comments
You need to be logged in to post comments
Add a Comment
Mario can't do much
(view all replies)Comment Reply
chickenmen - That's why I created this, to illustrate a method for background scrolling and character movement. Read the project notes and download the code to see how it's done.
(view all replies)Comment Reply
cool game how do you make him jump and how do you make the background go forever
(view all replies)Comment Reply
I get stuck on one flat course ..... aand my jumping dosnt do much..
(view all replies)Comment Reply
Dude the thing went reely far and umm it kind of sucks sorry look at my games "Mario" and "sugar rush mario"
(view all replies)Comment Reply
.......
(view all replies)Comment Reply
EVER!
(view all replies)Comment Reply
after a while, you can stand in mid air. I think that is because there is one platform and you and I think you never put the repeat until touching color gree. But I might be rong. Pretty good!
(view all replies)Comment Reply
glitchy
(view all replies)Comment Reply
glithy, but good.
(view all replies)Comment Reply
extremly glitchy but is pretty good
(view all replies)Comment Reply
pig - yes, I only account for one platform. The variable thing might be the layering bug in Scratch that I mention in the project notes.
(view all replies)Comment Reply
after you pass the 1st platform, you glide in mid-air...
(view all replies)Comment Reply
hmm, doesent work well... you can see a variable after you pass the castle
(view all replies)Comment Reply
Oh, im downloading this for sprites (and sounds(and playing))
(view all replies)Comment Reply
Tell me where i can find a gallery that teaches stuff!
(view all replies)Comment Reply
Yes, that's why I created it - so that other people could use the scrolling technique that I demonstrated.
(view all replies)Comment Reply
Can I use some of your scripts for a scrolling background in a game I am making? It has nothing to do with Mario, it is about a lost kitten, but I need help with the scrolling background. Please?
(view all replies)Comment Reply
But its a good game though..
(view all replies)Comment Reply
And it continues running alone...
(view all replies)Comment Reply
I can continue going after the castle and float on the sky.
(view all replies)Comment Reply
There are probably better ways to detect where Mario can and cannot land. I'm doing it here with X/Y position detection. Unfortunately, that doesn't scale very well since you have to check all of them. Some sort of trigger would be better. Scratch really starts to slow down though, so I don't know if a complex game like Mario is truly possible.
(view all replies)Comment Reply
he cant land on anything
(view all replies)Comment Reply
This would be the best mario game on scratch if you finished it.
(view all replies)Comment Reply
scrolling is perfect, even allowing mario to go back a few steps (without re-scrolling back). Good stuff demo even if the game doesnt actualy work
(view all replies)Comment Reply
o.....k.............phhh....
(view all replies)Comment Reply
The speed is highly dependent on your computer, probably your graphics card. Scratch lacks a timer, so there's no way to know how long a particular function takes so that you can even out the speed. The floating thing is because only the first platform is programmed.
(view all replies)Comment Reply
He goes floating in mid-air when you get far.
(view all replies)Comment Reply
Mario jumps too fast
(view all replies)Comment Reply
Added a Mario - he can jump to the first tower and fall. Note that you might need to restart a couple of times before you see Mario and the other moving characters - seems to be a layering bug.
(view all replies)Comment Reply
What do you mean by "play" ? All it does it let you scroll around. If it isn't scrolling from within the browser, then click on the window and try again - it needs to have "focus" when in a browser. Otherwise, download the project and run it in Scratch.
(view all replies)Comment Reply
it will not play...........
(view all replies)Comment Reply
Wonderful..........
(view all replies)Comment Reply