Hey Scratch,
Lately I have been playing around with the HTML 5 Canvas element. It is a great new way to create games on the internet without flash or java. Long story short, I decided to port my first scratch project into Canvas.
Here is my first scratch project (click the image):
and here is the HTML 5 project:
Canvas Grave Keeper
I am working on writing a tutorial on porting Scratch projects into Canvas.
Questions? Comments?
Last edited by midnightleopard (2011-10-16 14:19:31)
Offline
rookwood101 wrote:
cool! it works really well!
Thanks! I am working on porting some more old games and making some new games.
Offline
midnightleopard wrote:
rookwood101 wrote:
cool! it works really well!
Thanks! I am working on porting some more old games and making some new games.
well good luck, I'm sure it's a difficult thing to do.
Offline
I like it! I love canvas and I'm glad that people are using it to port games made in scratch.
Offline
Tell Us How To Do It
Offline
You should switch to SVG, that way you don't have to use a separate element for the score.
Offline
my favorite part of the code:
function init(){ canvas = document.getElementById("poop"); ctx = canvas.getContext("2d"); skeletonobj.x = randomX(); skeletonobj.y = randomY(); score = 0; setInterval(function(){ clear(); draw(); drive(); }, 15); }
look at line 2 in the code i posted :p XD lol
Offline
Just started using Canvas. I'm sad. I can't figure out how to make a ing animation loop.
::(
Last edited by scratchisthebest (2011-11-27 12:11:33)
Offline
Offline
Dawgles wrote:
...Why did you name your canvas element "poop"?
+1
I was wondering the sane thing
Offline
Oh hi!
I forgot about this thread because I had to bump it so much.
I forgot about the canvas name...
Long Story:
I started out with that whole thing as just a quick test, but it later evolved into a sophisticated port of grave keeper.
Short Story:
I'm immature.
Offline
scratchisthebest wrote:
Just started using Canvas. I'm sad. I can't figure out how to make a http://scratch.mit.edu/img/pages/credit … bullet.gifing animation loop.
:
What are you trying to say with the cat face?
Anyways, you can make a loop with the setInterval(function, interval-in-milliseconds) function and make three functions for drawing, updating variables, and erasing. I used
draw();
drive();
clear();
It looked like this:
setInterval(function(){ clear(); draw(); drive(); }, 15);
Offline
Oh!!! Kind of off topic, but I'd rather ask in a pre-existing thread than make a new one, and you said the word "setInterval" so I'm asking here: I've used setInterval successfully before, but now I'm trying to use it to run some AJAX, but it won't work. Is this because I'm running AJAX, or should I keep debugging?.
P.S. Right know I'm using a make-shift "setInterval" that basically runs itself every time a marque text finishes its cycle.
Offline
MoreGamesNow wrote:
Oh!!! Kind of off topic, but I'd rather ask in a pre-existing thread than make a new one, and you said the word "setInterval" so I'm asking here: I've used setInterval successfully before, but now I'm trying to use it to run some AJAX, but it won't work. Is this because I'm running AJAX, or should I keep debugging?.
P.S. Right know I'm using a make-shift "setInterval" that basically runs itself every time a marque text finishes its cycle.
Um... Well I don't really understand how AJAX could stop an interval loop, but I do know that that function is very delicate as in lots of things can stop it from working.
Offline
midnightleopard wrote:
MoreGamesNow wrote:
Oh!!! Kind of off topic, but I'd rather ask in a pre-existing thread than make a new one, and you said the word "setInterval" so I'm asking here: I've used setInterval successfully before, but now I'm trying to use it to run some AJAX, but it won't work. Is this because I'm running AJAX, or should I keep debugging?.
P.S. Right know I'm using a make-shift "setInterval" that basically runs itself every time a marque text finishes its cycle.Um... Well I don't really understand how AJAX could stop an interval loop, but I do know that that function is very delicate as in lots of things can stop it from working.
HOW DO YOU DO THAT?
Offline
flashgocrazy wrote:
midnightleopard wrote:
MoreGamesNow wrote:
Oh!!! Kind of off topic, but I'd rather ask in a pre-existing thread than make a new one, and you said the word "setInterval" so I'm asking here: I've used setInterval successfully before, but now I'm trying to use it to run some AJAX, but it won't work. Is this because I'm running AJAX, or should I keep debugging?.
P.S. Right know I'm using a make-shift "setInterval" that basically runs itself every time a marque text finishes its cycle.Um... Well I don't really understand how AJAX could stop an interval loop, but I do know that that function is very delicate as in lots of things can stop it from working.
HOW DO YOU DO THAT?
do what?
Offline
midnightleopard wrote:
flashgocrazy wrote:
midnightleopard wrote:
Um... Well I don't really understand how AJAX could stop an interval loop, but I do know that that function is very delicate as in lots of things can stop it from working.HOW DO YOU DO THAT?
do what?
DA CANVAS PORTING
Offline
flashgocrazy wrote:
midnightleopard wrote:
flashgocrazy wrote:
HOW DO YOU DO THAT?do what?
DA CANVAS PORTING
Ok. The post you quoted is irrelevant to your reply. Don't do that. If enough people want, I can make a tutorial.
Offline
midnightleopard wrote:
flashgocrazy wrote:
midnightleopard wrote:
do what?DA CANVAS PORTING
Ok. The post you quoted is irrelevant to your reply. Don't do that. If enough people want, I can make a tutorial.
SERIOUSLY, I NEED A TUT FOR HOW TO DO IT
Offline
Well, there isn't a magic button to make a project into HTML5. You'll need to get your hands dirty in Canvas.
==Scratch to HTML5 Mini-Tutorial==
1. Go to the library and find a good JS Canvas book.
2. Use the tools presented in the book to make a copy of a Scratch project.
3. Share.
4. Profit!!!111!!1!
==End of Mini-Tutorial==
Offline