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

#1 2013-03-14 20:43:05

StarscreamClone
Scratcher
Registered: 2012-05-19
Posts: 1000+

Soundwave Defense -- Need Help

Alright, so in a collab, I'm making a game for it where you make a sound into the mic and lasors shoot.  Unfortunately, I'm having a lot of trouble.  Here is what I need:
- Only have some of the lasors shoot at a time (I guess depending on loudness)
- Have it so the lasor shoots as fast as the sound is loud
- Have it so that the lasors glide to a set coordinate, then return to a set coordinate

Thanks so much, and I will credit you in the finished game.

Last edited by StarscreamClone (2013-03-14 20:43:15)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i1154.photobucket.com/albums/p522/lizzyhipo/Angelica101-1-1-1.jpg&link2=http://i46.tinypic.com/2elqwdy.png&link3=http://i1273.photobucket.com/albums/y404/Hulydooly/decepticon.jpg&link4=http://i44.tinypic.com/34rvb07.png

Offline

 

#2 2013-03-14 20:58:39

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Soundwave Defense -- Need Help

StarscreamClone wrote:

Alright, so in a collab, I'm making a game for it where you make a sound into the mic and lasors shoot.  Unfortunately, I'm having a lot of trouble.  Here is what I need:
- Only have some of the lasors shoot at a time (I guess depending on loudness)
- Have it so the lasor shoots as fast as the sound is loud
- Have it so that the lasors glide to a set coordinate, then return to a set coordinate

Thanks so much, and I will credit you in the finished game.

Just out of curiosity, how will you determine where the laser will shoot?

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2013-03-14 20:58:41

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

Re: Soundwave Defense -- Need Help

Well, the last one i can help with, though not sure about the first two.  sad

It should be easy, if soundwave is in the middle, then use the:

<touching? [edge v]>
Conditional.

Remember, you wouldn't use the Glide block, but really the move () steps block.  wink

I think you're good from there on that one, but if you need more detail, just ask.  smile

Make sense?

Regards,

CAA14

Last edited by CAA14 (2013-03-14 21:00:59)

Offline

 

#4 2013-03-14 20:59:48

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

Re: Soundwave Defense -- Need Help

ErnieParke wrote:

StarscreamClone wrote:

Alright, so in a collab, I'm making a game for it where you make a sound into the mic and lasors shoot.  Unfortunately, I'm having a lot of trouble.  Here is what I need:
- Only have some of the lasors shoot at a time (I guess depending on loudness)
- Have it so the lasor shoots as fast as the sound is loud
- Have it so that the lasors glide to a set coordinate, then return to a set coordinate

Thanks so much, and I will credit you in the finished game.

Just out of curiosity, how will you determine where the laser will shoot?

With regards,

ErnieParke

I was thinking the same thing, i would guess with the mouse...

Regards,

CAA14

Offline

 

#5 2013-03-14 22:00:26

Harald
New Scratcher
Registered: 2013-03-05
Posts: 34

Re: Soundwave Defense -- Need Help

I'm not sure if I'm even close to this level yet, or if this is exactly what you need, but here we go. It makes sense in my head at least.
A variable named loudness should be made, and then used like this:

when gf clicked
forever
 set [Loudness v] to (loudness)
Then, I'm guessing you have different sprites for each laser?
For each sprite, make one of these:

when gf clicked
forever
 if <(loudness) > [Loudness you want the laser to be activated at]>
 broadcast [Fire Laser 1 v]
Then you can make a formula with the loudness to determine the speed of the laser.

when I receive [Fire Laser 1 v]
go to [start position]
show
forever
 if <not <touching [edge v]>>
change x by <[5] + [0.1] * (Loudness)>
else
hide
There might be more advanced ways to get it done, but I hope it at least helps you in some way. 
Also, I have an unfinished shooter game, which contains scripts to make sure a laser cannot be fired again until it has hit it's target. I can upload the game for you to take a look at, if you wish.

Offline

 

#6 2013-03-15 09:20:19

StarscreamClone
Scratcher
Registered: 2012-05-19
Posts: 1000+

Re: Soundwave Defense -- Need Help

Harald wrote:

I'm not sure if I'm even close to this level yet, or if this is exactly what you need, but here we go. It makes sense in my head at least.
A variable named loudness should be made, and then used like this:

when gf clicked
forever
 set [Loudness v] to (loudness)
Then, I'm guessing you have different sprites for each laser?
For each sprite, make one of these:

when gf clicked
forever
 if <(loudness) > [Loudness you want the laser to be activated at]>
 broadcast [Fire Laser 1 v]
Then you can make a formula with the loudness to determine the speed of the laser.

when I receive [Fire Laser 1 v]
go to [start position]
show
forever
 if <not <touching [edge v]>>
change x by <[5] + [0.1] * (Loudness)>
else
hide
There might be more advanced ways to get it done, but I hope it at least helps you in some way. 
Also, I have an unfinished shooter game, which contains scripts to make sure a laser cannot be fired again until it has hit it's target. I can upload the game for you to take a look at, if you wish.

Ah, thank you!

@Rodimus and Ernie: The loudness would determine that; the lasors on the right side will fire if you reach a certain loudness.

Last edited by StarscreamClone (2013-03-15 09:23:07)


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i1154.photobucket.com/albums/p522/lizzyhipo/Angelica101-1-1-1.jpg&amp;link2=http://i46.tinypic.com/2elqwdy.png&amp;link3=http://i1273.photobucket.com/albums/y404/Hulydooly/decepticon.jpg&amp;link4=http://i44.tinypic.com/34rvb07.png

Offline

 

#7 2013-03-15 10:01:05

StarscreamClone
Scratcher
Registered: 2012-05-19
Posts: 1000+

Re: Soundwave Defense -- Need Help

Oh, and yes, that would be great!  Thanks so much!  big_smile


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i1154.photobucket.com/albums/p522/lizzyhipo/Angelica101-1-1-1.jpg&amp;link2=http://i46.tinypic.com/2elqwdy.png&amp;link3=http://i1273.photobucket.com/albums/y404/Hulydooly/decepticon.jpg&amp;link4=http://i44.tinypic.com/34rvb07.png

Offline

 

#8 2013-03-15 10:06:07

StarscreamClone
Scratcher
Registered: 2012-05-19
Posts: 1000+

Re: Soundwave Defense -- Need Help

Is now functioning; I think I'll leave the bit about until it reaches it's target; makes it more challenging.  I greatly appreciate you help, Harald, and will credit you in the final game.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i1154.photobucket.com/albums/p522/lizzyhipo/Angelica101-1-1-1.jpg&amp;link2=http://i46.tinypic.com/2elqwdy.png&amp;link3=http://i1273.photobucket.com/albums/y404/Hulydooly/decepticon.jpg&amp;link4=http://i44.tinypic.com/34rvb07.png

Offline

 

#9 2013-03-15 10:13:44

Harald
New Scratcher
Registered: 2013-03-05
Posts: 34

Re: Soundwave Defense -- Need Help

All right, it has been uploaded! ^^

Offline

 

#10 2013-03-15 10:23:45

Harald
New Scratcher
Registered: 2013-03-05
Posts: 34

Re: Soundwave Defense -- Need Help

I can't seem to find the "Edit message" option.. But I'm glad I could be of help! Good luck with the game.  big_smile

Offline

 

Board footer