Hi. I want to be able to press the 'n' key in order to shift to another Stage background. However, there are five stage backgrounds in all for this, and I don't know how to use 'n' to switch between these for the game.
Does anyone know the scripts necessary for this? Your answer is appreciated!
Offline
Okay Use the sub-heading 'When key 'n' Press' and then put the Next Background, which you can find in the background's Looks tab.
Offline
I did as you suggested, and I found that this also worked (Minus the sound blocks):
Thank you for the help!
Last edited by PrimusGod (2010-01-13 23:03:12)
Offline
Ace-of-Spades wrote:
Okay Use the sub-heading 'When key 'n' Press' and then put the Next Background, which you can find in the background's Looks tab.
This is a good solution. Note that it will cycle through the backgrounds in the order you have created them in the project. As many times as you press the "n" key.
If by some chance you want to *return* to a background before moving on then insert a copy of the earlier background later in the series and it will come up.
If you want more control than that, then other sprites would probably have to "broadcast" a background change based on some action elsewhere in the project.
Offline
Larry828 wrote:
Ace-of-Spades wrote:
Okay Use the sub-heading 'When key 'n' Press' and then put the Next Background, which you can find in the background's Looks tab.
This is a good solution. Note that it will cycle through the backgrounds in the order you have created them in the project. As many times as you press the "n" key.
If by some chance you want to *return* to a background before moving on then insert a copy of the earlier background later in the series and it will come up.
If you want more control than that, then other sprites would probably have to "broadcast" a background change based on some action elsewhere in the project.
Exactly. I had an arrow sprite that I was going to use based on the backgrounds. I ended up only using two scripts, one which involved using the last background to broadcast to it to hide. :D Thanks guys.
Last edited by PrimusGod (2010-01-13 23:52:26)
Offline
Ace-of-Spades wrote:
Okay Use the sub-heading 'When key 'n' Press' and then put the Next Background, which you can find in the background's Looks tab.
Also, please realize I have other backgrounds included other than these five, so this might be a drawback to what you are suggesting.
Offline
PrimusGod wrote:
I did as you suggested, and I found that this also worked (Minus the sound blocks):
Thank you for the help!
That's not exactly a great way to do it. A better way would be this:
<when green flag clicked>
<forever>
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions1
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions2
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions3
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions4
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions5
<end>
Offline
martianshark wrote:
PrimusGod wrote:
I did as you suggested, and I found that this also worked (Minus the sound blocks):
http://fc08.deviantart.net/fs71/f/2010/ … musGod.png
Thank you for the help!That's not exactly a great way to do it. A better way would be this:
<when green flag clicked>
<forever>
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions1
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions2
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions3
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions4
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions5
<end>
[/blocks]
Actually that would be worse (it would skip straight through), a better way, would be
to add a <wait until><< <not> <key[ n ]pressed?> >> [/blocks]
in-between each
<switch to costume[ ??? [/blocks] and <wait until> <key[ n ]pressed?> [/blocks]
Last edited by deatheater (2010-01-14 00:39:52)
Offline
Here's the simplest one yet:
[blocks]
<when green flag clicked>
<forever>
<if><key[ ]pressed?>
<next costume>(background)
<wait until><< <not> >><key[ ]pressed?>
<end>
<end>
[/blocks]
Offline
deatheater wrote:
martianshark wrote:
PrimusGod wrote:
I did as you suggested, and I found that this also worked (Minus the sound blocks):
http://fc08.deviantart.net/fs71/f/2010/ … musGod.png
Thank you for the help!That's not exactly a great way to do it. A better way would be this:
<when green flag clicked>
<forever>
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions1
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions2
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions3
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions4
<wait until> <key[ n ]pressed?>
<switch to costume[ Directions5
<end>[/blocks]
Actually that would be worse (it would skip straight through), a better way, would be
to add a <wait until><< <not> <key[ n ]pressed?> >> [/blocks]
in-between each
<switch to costume[ ??? [/blocks] and <wait until> <key[ n ]pressed?> [/blocks]
Oh yeah. I forgot about that part.
Offline