# Actionscript shooter

**URL:** <https://forum.kirupa.com/t/actionscript-shooter/304425>\
**Category:** flash\
**Created:** [February 7, 2010, 9:02pm UTC](https://forum.kirupa.com/t/actionscript-shooter/304425 "2010-02-07T21:02:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Script\_ist](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Script\_ist](https://forum.kirupa.com/u/Script_ist)\
**Post date:** [February 7, 2010, 9:02pm UTC](https://forum.kirupa.com/t/actionscript-shooter/304425/1 "2010-02-07T21:02:52Z")

</div>

Hello,  
I’m making a shooter where you are a plane and drop bombs on below boats(your flying over the sea) and I have 2 types of boats, a red and blue one.  
I want the game to make a random boat(either red or blue) to come along every now and then.

I have created a var Boat, and made it generate a random number between 0+1, so either 0 or 1. Then in the function on load put “if (Boat \> 0)” import the red boat and 1 for blue.

The problem is is that the red boat always comes, and not the blue boat, and if I make it 0 for the blue boat only the blue boat comes. I think its because when the game starts it generates the number that number is the same through out the game.

Does anyone know how to make it generate a random number each time a boat comes? Or anything else that might work.

Thanks, Script.Ist
