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

#1 2013-04-19 03:48:52

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

How to add difficulty settings to game

Right, what I currently have is a game where one charcter follows your mouse and another character trys to "catch" your character, what I want to do is have three buttons, one easy diffuclty which spawns 1 enemy character, medium difficulty spawns a second enemy character and finally a hard difficulty were it spawns a third enemy character. Any ideas on how to do this?

Offline

 

#2 2013-04-19 07:40:19

Tohmis
Scratcher
Registered: 2013-02-18
Posts: 58

Re: How to add difficulty settings to game

Try this

first Button easy

when gf clicked
broadcast [easy v]
Second Button medium
when gf clicked
broadcast [easy v]
broadcast [medium v]
third Button hard
when gf clicked
Broadcast [easy v]
broadcast [medium v]
Broadcast [hard v]
First enemy
When I receive [easy v]
Scripts
Second enemy
When I receive [medium v]
Scripts
Third enemy
When I receive [hard v]
Scripts
There is a project, where I use this: Link

I hope it helps  smile

Last edited by Tohmis (2013-04-19 07:41:02)


Check out my new game
http://scratch.mit.edu/static/projects/Tohmis/3300878_sm.png

Offline

 

#3 2013-04-19 07:42:14

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: How to add difficulty settings to game

Create the three buttons.
Create a variable called Difficulty.
Depending on what button is pressed change the difficulty variable to Easy, Medium or Hard.
Button press also launches a broadcast to start the game.
In sprites for your 3 monsters in the game start when I receive script put:

if <(Difficulty) = [Easy]>
Your script here
end
Replacing easy in the 2nd and third as appropriate.

EDIT: Above method would also work fine

Last edited by Smozzick (2013-04-19 07:43:59)


http://i50.tinypic.com/ded8m.png

Offline

 

#4 2013-04-19 14:10:14

Suparing01
New Scratcher
Registered: 2013-03-31
Posts: 49

Re: How to add difficulty settings to game

[scratchblocks]
when gf clicked
broadcast [difficulty menu]

[scratchblocks]
When [easy] clicked
broadcast [easydifficulty]

[scratchblocks]
When [hard] clicked
broadcast [harddifficulty]

[scratchblocks]
When [medium] clicked
broadcast [mediumdifficulty]

Sprite 1:

[scratchblocks]
when i receive [easy]
show

[scratchblocks]
when i receive [medium]
show

[scratchblocks]
when i receive [hard]
show



Sprite 2: [scratchblocks]
when i receive [medium]
show

[scratchblocks]
when i receive [hard]
show

Sprite 3:
[scratchblocks]
when i receive [hard]
show

Offline

 

#5 2013-04-19 14:15:06

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

Suparing01 wrote:

when gf clicked
broadcast [difficulty menu v]
When [easy v] clicked
broadcast [easydifficulty v]
When [hard v] clicked
broadcast [harddifficulty v]
When [medium v] clicked
broadcast [mediumdifficulty v]
Sprite 1:

when i receive [easy v]
show
when i receive [medium v]
show
when i receive [hard v]
show
Sprite 2:
when i receive [medium v]
show
when i receive [hardv v]
show
Sprite 3:
when i receive [hard v]
show

Fixed.  smile

You just need "[-/scratchblocks-]" after every "[-scratchblocks-]", without the "-"'s.


Regards,

CAA14

Last edited by CAA14 (2013-04-19 14:17:54)

Offline

 

#6 2013-04-19 14:31:21

Tohmis
Scratcher
Registered: 2013-02-18
Posts: 58

Re: How to add difficulty settings to game

To suparing01
A almost wrote the same.


Check out my new game
http://scratch.mit.edu/static/projects/Tohmis/3300878_sm.png

Offline

 

#7 2013-04-19 19:25:24

Suparing01
New Scratcher
Registered: 2013-03-31
Posts: 49

Re: How to add difficulty settings to game

CAA14 wrote:

Suparing01 wrote:

when gf clicked
broadcast [difficulty menu v]
When [easy v] clicked
broadcast [easydifficulty v]
When [hard v] clicked
broadcast [harddifficulty v]
When [medium v] clicked
broadcast [mediumdifficulty v]
Sprite 1:

when i receive [easy v]
show
when i receive [medium v]
show
when i receive [hard v]
show
Sprite 2:
when i receive [medium v]
show
when i receive [hardv v]
show
Sprite 3:
when i receive [hard v]
show

Fixed.  smile

You just need "[-/scratchblocks-]" after every "[-scratchblocks-]", without the "-"'s.


Regards,

CAA14

Silly me, thanks! :p

Offline

 

#8 2013-04-19 21:10:00

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

Suparing01 wrote:

CAA14 wrote:

Suparing01 wrote:

when gf clicked
broadcast [difficulty menu v]
When [easy v] clicked
broadcast [easydifficulty v]
When [hard v] clicked
broadcast [harddifficulty v]
When [medium v] clicked
broadcast [mediumdifficulty v]
Sprite 1:

when i receive [easy v]
show
when i receive [medium v]
show
when i receive [hard v]
show
Sprite 2:
when i receive [medium v]
show
when i receive [hardv v]
show
Sprite 3:
when i receive [hard v]
show

Fixed.  smile

You just need "[-/scratchblocks-]" after every "[-scratchblocks-]", without the "-"'s.


Regards,

CAA14

Silly me, thanks! :p

No problem.  wink

Regards,

CAA14

Offline

 

#9 2013-04-22 04:35:01

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

I can't find the "When * clicked" block, all I have is the "When sprite * clicked"

Offline

 

#10 2013-04-22 10:40:00

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

scorch2 wrote:

I can't find the "When * clicked" block, all I have is the "When sprite * clicked"

Yes, that's the one.  wink
The block is:

when [sprite 1] clicked
or, the green flag one is:

when gf clicked
If you are doing 2.0, then it's under events i believe, and in 1.4 i think it's under control.


Regards,

CAA14

Last edited by CAA14 (2013-04-22 10:40:53)

Offline

 

#11 2013-04-23 07:05:30

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

I can't change it from "sprite *". There is no events tab?

Offline

 

#12 2013-04-23 07:34:29

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

Actually, I have decided to put 3 sprites at the top and make it so when they are clicked the game begins, however, I have sprite 1 which is the character, sprite 2 which is the easy settings and sprite 3 which is the enemys, when I try to put "when sprite 2 clicked in the sprite 1 scripts, it only says "when sprite 1 clicked" so how can I change this?

Offline

 

#13 2013-04-23 07:41:02

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

Sorry for the triple post, I can't edit my previous posts. Forgot what I said in the previous posts, all I want to I want to know now is how to stop my three bad guys from overlapping each other and how to make the others enemys disappear if the easy setting is clicked?

Offline

 

#14 2013-04-23 11:27:20

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

scorch2 wrote:

Actually, I have decided to put 3 sprites at the top and make it so when they are clicked the game begins, however, I have sprite 1 which is the character, sprite 2 which is the easy settings and sprite 3 which is the enemys, when I try to put "when sprite 2 clicked in the sprite 1 scripts, it only says "when sprite 1 clicked" so how can I change this?

Ah... i see.

Well, you really can't, but there are work arounds. Basically, you can do any of these things:

- Make a variable that is set to no if sprite 2 is not clicked(at the start up) and yes once it is.
- use a broadcast that sprite 2 sends when it's clicked.

Regards,

CAA14

Offline

 

#15 2013-04-25 05:50:45

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

CAA14 wrote:

scorch2 wrote:

Actually, I have decided to put 3 sprites at the top and make it so when they are clicked the game begins, however, I have sprite 1 which is the character, sprite 2 which is the easy settings and sprite 3 which is the enemys, when I try to put "when sprite 2 clicked in the sprite 1 scripts, it only says "when sprite 1 clicked" so how can I change this?

Ah... i see.

Well, you really can't, but there are work arounds. Basically, you can do any of these things:

- Make a variable that is set to no if sprite 2 is not clicked(at the start up) and yes once it is.
- use a broadcast that sprite 2 sends when it's clicked.

Regards,

CAA14

Thats sorted, now how can I stop my three enemys from overlapping when chasing my character?

Offline

 

#16 2013-04-25 07:19:55

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

scorch2 wrote:

CAA14 wrote:

scorch2 wrote:

Actually, I have decided to put 3 sprites at the top and make it so when they are clicked the game begins, however, I have sprite 1 which is the character, sprite 2 which is the easy settings and sprite 3 which is the enemys, when I try to put "when sprite 2 clicked in the sprite 1 scripts, it only says "when sprite 1 clicked" so how can I change this?

Ah... i see.

Well, you really can't, but there are work arounds. Basically, you can do any of these things:

- Make a variable that is set to no if sprite 2 is not clicked(at the start up) and yes once it is.
- use a broadcast that sprite 2 sends when it's clicked.

Regards,

CAA14

Thats sorted, now how can I stop my three enemys from overlapping when chasing my character?

Fortunately, that's real easy. The problem is that, as far as it sounds, you do not have any layer order, meaning that your enemies aren't in different places as far as back and forth, unless you click on one to bring it to the front. To control what layer a sprite is on, this is the most easy way I know of so far:

When gf clicked
Broadcast [layer 1 v]
Broadcast [layer 2 v]
Broadcast [layer 3 v]
Etc... 
It really doesn't matter where you put the above script, but I would suggest somewhere you will remember, like the stag or main character sprite.

Then, once you have as many layers as you need, then put this in the scripts of all your sprites:


When I receive [layer 1 v]
go to front 
Now remember, your basically stacking the layers, starting at [i]the bottom and stacking to the top[/]. This means that layer 1 is the bottom.  wink


Hope that helps,

CAA14

Last edited by CAA14 (2013-04-25 07:20:20)

Offline

 

#17 2013-04-25 09:27:29

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

CAA14 wrote:

scorch2 wrote:

CAA14 wrote:


Ah... i see.

Well, you really can't, but there are work arounds. Basically, you can do any of these things:

- Make a variable that is set to no if sprite 2 is not clicked(at the start up) and yes once it is.
- use a broadcast that sprite 2 sends when it's clicked.

Regards,

CAA14

Thats sorted, now how can I stop my three enemys from overlapping when chasing my character?

Fortunately, that's real easy. The problem is that, as far as it sounds, you do not have any layer order, meaning that your enemies aren't in different places as far as back and forth, unless you click on one to bring it to the front. To control what layer a sprite is on, this is the most easy way I know of so far:

When gf clicked
Broadcast [layer 1 v]
Broadcast [layer 2 v]
Broadcast [layer 3 v]
Etc... 
It really doesn't matter where you put the above script, but I would suggest somewhere you will remember, like the stag or main character sprite.

Then, once you have as many layers as you need, then put this in the scripts of all your sprites:


When I receive [layer 1 v]
go to front 
Now remember, your basically stacking the layers, starting at [i]the bottom and stacking to the top[/]. This means that layer 1 is the bottom.  wink


Hope that helps,

CAA14

Right I did the above, I put the code when I receive layer 1 go to front in my first enemy, when I receive layer 2 go to front in second enemy etc. But they still overlap each, all three enemys just go together and look like a single enemy chasing the character?

Offline

 

#18 2013-04-25 23:30:49

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

scorch2 wrote:

CAA14 wrote:

scorch2 wrote:


Thats sorted, now how can I stop my three enemys from overlapping when chasing my character?

Fortunately, that's real easy. The problem is that, as far as it sounds, you do not have any layer order, meaning that your enemies aren't in different places as far as back and forth, unless you click on one to bring it to the front. To control what layer a sprite is on, this is the most easy way I know of so far:

When gf clicked
Broadcast [layer 1 v]
Broadcast [layer 2 v]
Broadcast [layer 3 v]
Etc... 
It really doesn't matter where you put the above script, but I would suggest somewhere you will remember, like the stag or main character sprite.

Then, once you have as many layers as you need, then put this in the scripts of all your sprites:


When I receive [layer 1 v]
go to front 
Now remember, your basically stacking the layers, starting at [i]the bottom and stacking to the top[/]. This means that layer 1 is the bottom.  wink


Hope that helps,

CAA14

Right I did the above, I put the code when I receive layer 1 go to front in my first enemy, when I receive layer 2 go to front in second enemy etc. But they still overlap each, all three enemys just go together and look like a single enemy chasing the character?

Hmm... Are you sure that you do not have "go to front" blocks in your scripts? Also, are you clicking on them? That automatically brings them to the front...

Regards,

CAA14

Offline

 

#19 2013-04-26 03:53:50

scorch2
New Scratcher
Registered: 2013-04-19
Posts: 10

Re: How to add difficulty settings to game

I have three layers, layer one for the first enemy, layer 2 for the 2nd etc and those blocks have go to front on them but they stuill go on top of each other and I am not clicking on the enemys since they automatically follow the players character until caught.

Offline

 

#20 2013-04-27 22:02:57

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: How to add difficulty settings to game

scorch2 wrote:

I have three layers, layer one for the first enemy, layer 2 for the 2nd etc and those blocks have go to front on them but they stuill go on top of each other and I am not clicking on the enemys since they automatically follow the players character until caught.

Well, are you broadcasting the layers at the beginning?

I would have to see your scripts to find out the problem know it seems.

Make sure that you change the receiving script to match the layer...

Regards,

CAA14

Last edited by CAA14 (2013-04-27 22:05:52)

Offline

 

Board footer