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

#1 2012-05-01 05:09:38

marieawhit
New Scratcher
Registered: 2012-05-01
Posts: 5

Scripting Game Help - Three Questions

Hello!

I am new to the world of Scratch game making and I was hoping that one of you might be willing to help me script two things in my game. First, I need help making an enemy disappear after being hit with a weapon - basically coding it so that the enemy recognizes that its "dead." Secondly, generating a score for each enemy death; and lastly, creating waves of enemies for each level at different speed intervals - like in Plants vs Zombies how there are a few zombies here and there and when they are all defeated, a huge horde attacks the hero. Any help would be very much appreciated!! Thanks!!

Offline

 

#2 2012-05-02 00:02:07

AliensFTW
New Scratcher
Registered: 2012-05-01
Posts: 19

Re: Scripting Game Help - Three Questions

The first two questions are simple and can be attempted using these blocks.
First create a variable called health.
You will also need a variable called xp.
[scratchblocks]
when gf clicked
set [health] to (5)




when gf clicked
forever if < touching [weapon] >
     change [health] by (-1)
end

when gf clicked
if < (health) < [1] >
     hide
     change [xp] by (1)
end


// the last one is the hardest. To make them move faster at different intervals, make a //variable called round number. This would be the number for the wave.

When gf clicked
set [round number] to (1)

When gf clicked
show
forever
     change x by (round number)
     wait (0.1) sec.
end

// this will make the enemies move faster with each round.
// these scripts are general, so don't copy them exactly, but edit them to your liking.

Offline

 

#3 2012-05-02 05:49:11

marieawhit
New Scratcher
Registered: 2012-05-01
Posts: 5

Re: Scripting Game Help - Three Questions

Wow!! Thank you so much!! You've been a huge help!
I do have one more question - is there a way to script an enemy to regenerate at random time intervals after dying?

Offline

 

#4 2012-05-02 08:02:13

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Scripting Game Help - Three Questions

AliensFTW wrote:

The first two questions are simple and can be attempted using these blocks.
First create a variable called health.
You will also need a variable called xp.

when gf clicked
set [health] to (5)




when gf clicked
forever if < touching [weapon] >
     change [health] by (-1)
end

when gf clicked
if < (health) < [1] >
     hide
     change [xp] by (1)
end


// the last one is the hardest. To make them move faster at different intervals, make a

//variable called round number. This would be the number for the wave.

When gf clicked
set [round number] to (1)

When gf clicked 
show
forever
     change x by (round number)
     wait (0.1) sec.
end

// this will make the enemies move faster with each round.
// these scripts are general, so don't copy them exactly, but edit them to your liking.

fixed scratchblocks


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#5 2012-05-02 10:42:54

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: Scripting Game Help - Three Questions

marieawhit wrote:

Wow!! Thank you so much!! You've been a huge help!
I do have one more question - is there a way to script an enemy to regenerate at random time intervals after dying?

when gf clicked
forever
wait until <(health) = [0]>
hide
wait  (pick random (1) to (10)) secs
go to [spawnpoint v]


http://i47.tinypic.com/2iaa73k.png

Offline

 

#6 2012-05-02 11:23:07

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Scripting Game Help - Three Questions

berberberber wrote:

when gf clicked
forever
wait until <(health) = [0]>
hide
wait  (pick random (1) to (10)) secs
set [health v] to (5)
go to [spawnpoint v]

I added a "set health" block.

Alternatively:

when gf clicked
forever
wait  (pick random (1) to (10)) secs
set [health v] to (5)
go to [spawnpoint v]
repeat until <(health) < (1)>
be alive
end
hide

Last edited by MoreGamesNow (2012-05-02 11:25:05)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#7 2012-05-02 23:13:38

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: Scripting Game Help - Three Questions

zammer990 wrote:

AliensFTW wrote:

The first two questions are simple and can be attempted using these blocks.
First create a variable called health.
You will also need a variable called xp.

when gf clicked
set [health] to (5)




when gf clicked
forever if < touching [weapon v]? >
     change [health] by (-1)
end

when gf clicked
if < (health) < [1] >
     hide
     change [xp] by (1)
end


// the last one is the hardest. To make them move faster at different intervals, make a

//variable called round number. This would be the number for the wave.

When gf clicked
set [round number] to (1)

When gf clicked 
show
forever
     change x by (round number)
     wait (0.1) secs
end

// this will make the enemies move faster with each round.
// these scripts are general, so don't copy them exactly, but edit them to your liking.

fixed scratchblocks

now they're fixed!


http://i47.tinypic.com/2iaa73k.png

Offline

 

#8 2012-05-03 01:37:23

marieawhit
New Scratcher
Registered: 2012-05-01
Posts: 5

Re: Scripting Game Help - Three Questions

You guys are amazing! Thank you so much for helping me out on my game!

Offline

 

#9 2012-05-03 07:33:34

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Scripting Game Help - Three Questions

marieawhit wrote:

You guys are amazing! Thank you so much for helping me out on my game!

Then, you should request for this topic to be closed by clicking the "Report" button and say that you want this thread closed.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#10 2012-05-03 18:02:35

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Scripting Game Help - Three Questions

Closed by request of topic owner.


http://i.imgur.com/WBkM2QQ.png

Offline

 

Board footer