sandyjabbour
06-29-2009, 06:53 PM
hello.
i am new here.. i am making a simple game :
it has a player and a machine playing
with a dice to roll
my idea is that you press the roll button and it roll the dice and it shows some bullets on the place of machine or the player zone depending on the number showed in the dice [ the number is randomly generated]
the dice is a movie clip tht has 6 keyframes.
the player_zone/machine_zone is the place where the bullet will show
anyways .. i dont know if my code is correct.. please any1 know wat is wrong ? :"(
function rolling(event:MouseEvent):void
{
var dicePlayer:Number = Math.ceil(Math.random()*6);
player_zone.new bullet(); +=dicePlayer;
dice.gotoAndStop(dicePlayer);
var valPl = player_zone
var valCm = machine_zone
var diceMachine:Number = Math.ceil(Math.random()*6);
if (valPl - valCm > 8 )
diceMachine = Math.ceil(Math.random()*6)+ 34;
machine_zone.new bullet(); +=dicePlayer;
}
roll.addEventListener(MouseEvent.CLICK, rolling);
i am new here.. i am making a simple game :
it has a player and a machine playing
with a dice to roll
my idea is that you press the roll button and it roll the dice and it shows some bullets on the place of machine or the player zone depending on the number showed in the dice [ the number is randomly generated]
the dice is a movie clip tht has 6 keyframes.
the player_zone/machine_zone is the place where the bullet will show
anyways .. i dont know if my code is correct.. please any1 know wat is wrong ? :"(
function rolling(event:MouseEvent):void
{
var dicePlayer:Number = Math.ceil(Math.random()*6);
player_zone.new bullet(); +=dicePlayer;
dice.gotoAndStop(dicePlayer);
var valPl = player_zone
var valCm = machine_zone
var diceMachine:Number = Math.ceil(Math.random()*6);
if (valPl - valCm > 8 )
diceMachine = Math.ceil(Math.random()*6)+ 34;
machine_zone.new bullet(); +=dicePlayer;
}
roll.addEventListener(MouseEvent.CLICK, rolling);