This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-06-11 12:40:41

Cooldude007
Scratcher
Registered: 2012-05-23
Posts: 8

Help on scripts!

I really want to make a war game but I don't know what to put in the scripts for: Bullets, person jumping, opposite side of the game (CPU) and how to use scrollX.

Could you please tell me what are the basic scripts for each please!!!

when gf clicked
forever
     help [me  v]
     for [war] game
     thanks [you are awesome  v]
end

Offline

 

#2 2012-06-11 13:32:58

Hotwire
Scratcher
Registered: 2011-08-10
Posts: 500+

Re: Help on scripts!

Well for bullets you can start off with the basic way of having several bullet sprites that when the mouse is clicked the bullets are fired in that direction and keeps going until it hits a wall or the person.
So...
When green flag clicked
forever
if <mouse down>
[change [shot] by [1]]          (This means that each bullet will fire individually)
[broadcast [shot]]                (This will tell the bullets that a shot has been made)
[wait until <not<mouse down>>]


Bullets:

When I recieve [shot]
if <<shot>= [(numberof the bullet)]>
[point towards mous pointer]
[repeat until <touching (wall/object/colour)>
[move [5] steps]
]
[switch to costume [explode]]
[hide]

Hope this helps  smile


For the bullets


http://i47.tinypic.com/293wn60.png

Offline

 

#3 2012-06-11 18:57:09

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Help on scripts!

Hotwire wrote:

When green flag clicked
forever
if <mouse down>
[change [shot] by [1]]          (This means that each bullet will fire individually)
[broadcast [shot]]                (This will tell the bullets that a shot has been made)
[wait until <not<mouse down>>]

Using the change [shot] by 1 isn't the most efficient way, I prefer using lists.

Put this anywhere

when gf clicked
forever
if <<mouse down?> and <not <<length of [bullets v]> = [0]>>>
broadcast <join [bullet] <item [1] of [bullets v]>>
delete [1] of [bullets v]
wait [0.2] secs
end
end
Put this on the first bullet.
when I receive [bullet1 v]
shoot the bullet
add [1] to [bullets v]
stop script
Second bullet
when I receive [bullet2 v]
shoot the bullet
add [2] to [bullets v]
stop script
Third bullet
when I receive [bullet3 v]
shoot the bullet
add [3] to [bullets v]
stop script


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

Board footer