I’m sorry about not finishing your foter game before hand…
It just appeared to me that I started it and never finished it lol…
But yeah… here goes… Since I made it home before you re-posted…
When you look at the mini-game you see a ship… And when you move the mouse… The ship moves along with the mouse… When you click the mouse button it’ll fire…
So We know now… How it’s event driven… So let’s do a basic algorithm…
onMouseButtonDown
{
fire bullet;
}
onMouseButtonMove
{
move ship;
}
So you take a look at that… And any flash as programme rwould know that this would present lots of errors… But it’s a good blueprint for when you code…
There is also the 4 keyboard inputs… 1,2,3,0 And what do these do… Why they change the add-on guns… So…
if(keyboard key 1 is hit)
{
change gun to spreader;
}
if(keyboard key 2 is hit)
{
change gun to machine gun;
}
if(keyboard key 3 is hit)
{
change gun to big assed gun;
}
if(keyboard key 0 is hit)
{
remove any addon gun;
}
That’s pretty easy for us English speaking civilians to understand correct?
Now letake this a step further… We have all our basic inputs now… The mouse button clicking, the mouse moving and the t’s 4 keys…
Now… This just steps up then… I could then say… Well… When each addon gun is added… We have to get rid of any previous gun that was possibly there… So there won’t be any overlapping… So…
if(keyboard key 1 is hit)
{
remove any other addon gun if need be;
change gun to spreader;
}
if(keyboard key 2 is hit)
{
remove any other addon gun if need be;
change gun to machine gun;
}
if(keyboard key 3 is hit)
{
remove any other addon gun if need be;
change gun to big assed gun;
}
if(keyboard key 0 is hit)
{
remove any addon gun;
}
And it goes on and on… Until you have this big list of algorithms… Then you just take the algorithsm… And place the actual code in each one… and wammo… Fix a couple of erros and your set in gold…
This works for pretty much everything… Writing algoritms on pieces of paper or in Notepad can help you think abut how the code can come into place… SOmeitme the algorithsm won’t work as planned… But 90% of thetime they work perfectly…
I hope this helped.