Hello,
I have recently downloaded Scratch and am familiar with its interface.
I wanted to know how to make a game like Snake.
I want the cat to move around with controls from the keyboard.
I want there to be a little kitty bowl somewhere on the screen.
When the cat touches the kitty bowl, the score goes up by 1.
The kitty bowl then moves to another place. (just like Snake)
How would I do this?
Offline
Each time the player collides with the bowl, generate a random x and y value for it, and increment the score by 1.
Offline
How do I generate a random x and y value?
Offline
Oh and also,
if anyone knows how?
Say there is a dog going back and forth on the screen (i know how to do that)
I want to have it so if the cat hits the dog, the lives decrease by one, but after
you lose a life, you become sorta transparent which prevents you from losing like 60 lives in one shot if the dog is on top of you... thanks so much!!! and thank you gamerfreak for your earlier help!!
Offline
To make an object go to a random spot on the screen, use a move to block with random numbers inside.
For the second problem, I would make a variable called transparent, and let it be 0 when the cat is not transparent and let it be 1 when the cat is not transparent. For the cat to lose a life, you check to make sure that the cat is not transparent (using an if block).
Have fun making Snake.
Paulmedwal
Offline
I just tried making snake and I ran into a bit of a problem.
Usually when I make snake, I use an array to keep an array or list to keep track of the snakes previous x,y coordinates so the game knows which points to clean up on the snake's tail.
Scratch doesn't support data structures, so is there another way to do this?
Offline
hmm, Read your idea, and deicded to make something along the lines... Is this anything like what you were thinking of? By that way, I'm only trying to find ideas so i can practise my skills so i can get better
http://scratch.mit.edu/projects/Dthen/3801
Offline
I made a snake game for scratch a while ago (in December I think)...I'll see if I can find it on my computer. Basically, I had each of the elements of the tail to have its own variable (x,y coordinates). Then when the bug moved, each part of the tail took the place of the one before it by just changing all of the variables. Unfortunately, this severally limited the total length of the tail before scratch got extremely slow (I could only have 3 mini circles as the tail). I had obstacles randomly pop up on the screen after you got a "happy face", so the game became interesting by avoiding the obstacles and not going backwards (because of your tail), but the length of the tail did not play much of a role.
Paulmedwal
Offline
I want to know how in genral make a game were enemys try to get you and you have to get to a camera and every time you get to the camera you go to another level. and you get 5 lives.
Offline
<when[ ]key pressed> for cat = <when[ up ]key pressed>
<change y by(1)>
<when[ down ]key pressed>
<change y by( 1)>
<when green flag clicked>
<forever><wait until><touching[sprite]>
<broadcast[ something ]>
for cheese puffs = <when I receive[ somthing ]>
<go to x <pick random( )to( )y
<pick random( )to( )>
Offline
i would really like to learn how to make a game out of scratch and i <clear>ly dont know
Offline
nikolas555 wrote:
<when[ ]key pressed> for cat = <when[ up ]key pressed>
<change y by(1)>
<when[ down ]key pressed>
<change y by( 1)>
anoying mistake there. The <when[ up ]key pressed> block is the worst block to use for games. Let me try explain. This type of block is more used for typing styled things. for example as im typing now, if i hold down a key, lets say S, it pritns the letter S and then pauses for a second before printing loads of S's. The same works if you use that block, it has a pause. for games you want something like this: [blocks]
<when green flag clicked>
<forever>
<if><key[ Up ]pressed?>
<end>
<end>
As for your problem for snakes (on the food bowl):
<when green flag clicked>
<forever>
<if><touching[ snake ]>
<change{ score }by( 1 )>
<set x to( <pick random( -240 )to( 240 ) )>
<set y to( <pick random( -140 )to( 140 ) )>
<end>
<end>
[/blocks]
If you want invisability when the dog touches the cat (asked by someone else) simply when you touch the dog change the variable and then <wait until><< <not> <touching[ dog ] >>
Last edited by yambanshee (2008-12-07 11:27:00)
Offline
Hi,
I wanted to ask how to I make this snake game with speech commands? (up, down, left, right). How do I make the change the controls from keyboard to something else?
I am new to all this - some pointers please. .
Offline
http://scratch.mit.edu/forums/viewtopic.php?pid=235090#req_messagehttp://scratch.mit.edu/fo<change{ }by( <change{ }by( <change{ }by( http://scratch.mit.edu/forums/viewtopic.php?pid=235090#req_messagerums/viewtopic.php?pid=235090#req_message
Offline
how do you aoutomatically make a game pause at the beginning of each elvel for one second so that the user has an idea of where the spsrite is before taking control of the sprite itself? Could someone help me please?
Offline