Hello! I am going to teach you how to make make a platformer! First off, Velocity and sensing.
First, copy the costume and fill it all in black. Next, put a different color on each side. Then use this script:
When green flag clicked
forever
Switch to costume sensing
If color on right touching color black
Set X Velocity to -1
End if
If color on left touching color black
Set X Velocity to 1
End if
If bottom color touching black
If key up arrow pressed
set Y Velocity to 10
End if
Else
Change Y Velocity by -1
End If Else
If Top color touching color black
set Y Velocity to -3
End if
If key right arrow pressed
Change X Velocity by 1
End If
If key left arrow pressed
Change X Velocity by -1
End If
set X Velocity to X Velocity * 0.9
change x by X Velocity
change y by Y Velocity
end forever
Switch to costume Regular
Last edited by ImagineIt (2011-07-31 10:58:38)
Offline
Thanks Imagineit! I will try it out . But one question. Of course no body wants others to see that sensor costume. Are we allowed to change it and the script will still work?
Offline
Thescratch3 wrote:
Thanks Imagineit! I will try it out
. But one question. Of course no body wants others to see that sensor costume. Are we allowed to change it and the script will still work?
It won't show up. I forgot to finsish it too.
Offline
ImagineIt wrote:
Thescratch3 wrote:
Thanks Imagineit! I will try it out
. But one question. Of course no body wants others to see that sensor costume. Are we allowed to change it and the script will still work?
It won't show up. I forgot to finsish it too.
It won't show up?
Offline
Thescratch3 wrote:
ImagineIt wrote:
Thescratch3 wrote:
Thanks Imagineit! I will try it out
. But one question. Of course no body wants others to see that sensor costume. Are we allowed to change it and the script will still work?
It won't show up. I forgot to finsish it too.
It won't show up?
It happens so fast that you don't see the sensing.
Offline
ImagineIt wrote:
Thescratch3 wrote:
ImagineIt wrote:
It won't show up. I forgot to finsish it too.It won't show up?
It happens so fast that you don't see the sensing.
Huh?
Offline
That is, depending on a script length in scratch and a block's location on the script, it may occur between renderings. The script is executed, but a change afterword negates/overrides it before it is rendered. In this example:
CostumeToSee changes to SensingCostume
Find out which directions you can go
Switch back to CostumeToSee
RenderImage/RenderFrame
Curiously, this only works in presentation mode, so while in the script editor, the sprite WILL appear to flash from one costume to the next very quickly, but try it in presentation mode, and it should (hopefully) remain only on the costume you want. Hope this helps.
Offline
MoreGamesNow wrote:
That is, depending on a script length in scratch and a block's location on the script, it may occur between renderings. The script is executed, but a change afterword negates/overrides it before it is rendered. In this example:
CostumeToSee changes to SensingCostume
Find out which directions you can go
Switch back to CostumeToSee
RenderImage/RenderFrame
Curiously, this only works in presentation mode, so while in the script editor, the sprite WILL appear to flash from one costume to the next very quickly, but try it in presentation mode, and it should (hopefully) remain only on the costume you want. Hope this helps.
Yup!
Offline
ImagineIt wrote:
MoreGamesNow wrote:
That is, depending on a script length in scratch and a block's location on the script, it may occur between renderings. The script is executed, but a change afterword negates/overrides it before it is rendered. In this example:
CostumeToSee changes to SensingCostume
Find out which directions you can go
Switch back to CostumeToSee
RenderImage/RenderFrame
Curiously, this only works in presentation mode, so while in the script editor, the sprite WILL appear to flash from one costume to the next very quickly, but try it in presentation mode, and it should (hopefully) remain only on the costume you want. Hope this helps.Yup!
So your script says switch to costume sensor. I can easily say at the end of the script switch to costume whatever?
Offline
Thanks! I am working on one using this technique!
Offline
Can you post the scrolling one with y and x?
Offline
Well, I'm not sure if clear cut rules have been developed, but here are some I can think of:
The script can be fairly lengthy (see many 1s1s games that use this to paste walls/floors and return to position between frames)
Adding repeat(), repeat until<>, or other blocks with a built-in time restraint will break this neat trick too.
The built-in time restraint is a small amount of time. It is quite nice in some cases (e.g. not making your sprite move extremely quickly across the screen, but gliding more slowly), but it slows down Scratch as a whole. This is a main difference between normal and TURBO speed. TURBO speed eliminates the delay, but can also be devastating if you rely on the delay in your project.
You're probably thinking: TMI, lol. But to answer your question, usually yes, as long as you avoid loops.
Offline
ImagineIt wrote:
Hello! I am going to teach you how to make make a platformer! First off, Velocity and sensing.
First, copy the costume and fill it all in black. Next, put a different color on each side. Then use this script:
When green flag clicked
forever
Switch to costume sensing
If color on right touching color black
Set X Velocity to -1
End if
If color on left touching color black
Set X Velocity to 1
End if
If bottom color touching black
If key up arrow pressed
set Y Velocity to 10
End if
Else
Change Y Velocity by -1
End If Else
If Top color touching color black
set Y Velocity to -3
End if
If key right arrow pressed
Change X Velocity by 1
End If
If key left arrow pressed
Change X Velocity by -1
End If
set X Velocity to X Velocity * 0.9
change x by X Velocity
change y by Y Velocity
end forever
Switch to costume Regular
Thanks I am actually changing the scripts from velocities to scroll! I might got the grasp for scroll thanks to you
....
Offline
Imagineit will you post anything else about this?
Offline
Thescratch3 wrote:
Imagineit will you post anything else about this?
What should I? Please give more information on what you would like!
Offline
ImagineIt wrote:
Thescratch3 wrote:
Imagineit will you post anything else about this?
What should I? Please give more information on what you would like!
How about some you know fighting game stuff? (Just to let you know I used this technique again but this time no scrolling and it didn't work but I managed some how)
Offline