Also quick change to setColor function, you forgot “0x” so it doesn’t set the color [AS]bcp.setColor = function( mc )
{
var colorObj = new Color( mc );
randColor = random(this.colors.length);
colorObj.setRGB(“0x”+this.colors[randColor]);
}[/AS]
[size=1]they call me janitor… :cape blows in wind:[/size]
Probably, but that’s just presentation I think I’ll remove what I posted, because we definitely need to decide how we are going to structure the code. Thor, Sen, Ahmed, get back here!! We need to talk!!!
how about this structure; each individual component of the game has its own class. We could have a Player, a Well, and a Seed class. Then, We would have the Game class, which stores two instances of Player (player1, player2), and an Array of 4 Well instances. The Well class, in return, stores ian Array with 4 Seed instances in it. I don’t know if this makes sense, i’ll be posting the code i’ve came up with so far in a few
Bantumi = new Object();
Bantumi.Player = function () {}
Bantumi.Game = function ()
{
this.Player1 = new Bantumi.Player();
this.Player2 = new Bantumi.Player();
// Array to store well instances
this.Wells = new Array();
// the timeline on which the clips of all Well will be attached
this.timeline = _root;
// this will be incremented with the instantiation of each Well
this.depth = 0;
// create 6 Well instances with Player1 as their owner.
for ( var i=0 ; i<6; i++ )
this.Wells.push( new Bantumi.Well( this, Player1, i ) );
// create 6 Well instances with Player2 as their owner.
for ( var i=0 ; i<6; i++ )
this.Wells.push( new Bantumi.Well( this, Player2, i ) );
}
Bantumi.Well = function ( Game, Owner, WellNumber )
{
// set Well's owner and number
this.Owner = Owner;
this.WellNumber = WellNumber;
// attach Well clip on the Game.timeline property
this.clip = Game.timeline.attachMovie( "well", "well" + Game.depth++ , Game.depth );
// array to store seed instances
this.seeds = new Array();
// instantiate 4 seed objects
for ( var i=0 ; i<4 ; i++ )
this.seeds.push( new Bantumi.Seed( this , i) );
}
Bantumi.Seed = function ( Well , SeedNumber )
{
this.parentWell = Well;
this.clip = Well.clip.attachMovie( "seed" , "seed"+SeedNumber, SeedNumber);
}
I am humbled by your coding abilities… but here are my thoughts, just so I can feel Im involved and learning.
With the wells numbered in sequence, won’t the counterclockwise movement always be correct? Meaning, we should be able to make it drop into the next well number. We just have to set up “special circumstances” for well 7 and 14. Right?
With that in mind, is it beneficial to set up prototype "player?"
as in 8-14 belong to player 2 and 1-7 belong to player 1?
on the create well function… I thought we would just use mc’s for the wells that are already placed on the scene. After all, we have to match up the well position with a predetermined position from the board graphic. Right?
Sorry for not replying any earilier. Anywho, I thought each member had 6 wells, my bad, guess i’ll have to re-read the rules over heh…
The wells could be tied to actual clips on the stage, i’ll rework my code for that
The reason i had a “Player” class was that i thought we’ll eventually need a place to store certain properties of each player, like score, or character, for example.
I posted the code above was really to explain the structure i was suggesting.
I’ll be going over the rules again tonight and edit the code i posted
Bantumi = new Object();
Bantumi.wellXSpacing = 80 ;
Bantumi.wellYSpacing = 200 ;
Bantumi.Player = function () {}
Bantumi.Game = function ()
{
this.Player1 = new Player();
this.Player2 = new Player();
// Array to store well instances
this.Wells = new Array();
// the timeline on which the clips of all Well will be attached
this.timeline = _root;
// this will be incremented with the instantiation of each Well
this.depth = 0;
// create 6 Well instances with Player1 as their owner.
this.WellContainer1 = this.timeline.createEmptyMovieClip ( "WC1", 0 ) ;
this.WellContainer2 = this.timeline.createEmptyMovieClip ( "WC2", 1 ) ;
for ( var i=0 ; i<7; i++ )
this.Wells.push( new Bantumi.Well( this, this.WellContainer1, "Player1", i ) );
// create 6 Well instances with Player2 as their owner.
for ( var i=0 ; i<7; i++ )
this.Wells.push( new Bantumi.Well( this, this.WellContainer2, "Player2", i ) );
}
Bantumi.Well = function ( Game, timeline, Owner, WellNumber )
{
// set Well's owner and number
this.Owner = Owner;
this.WellNumber = WellNumber;
// attach Well clip on the Game.timeline property
this.clip = timeline.attachMovie( "well", "well" + Game.depth++ , Game.depth );
if (Owner == "Player1") {
var x = WellNumber * Bantumi.wellXSpacing ;
var y = WellNumber == 0 ? Bantumi.wellYSpacing / 2 : 0 ;
}
else {
var x = 7*Bantumi.wellXSpacing - WellNumber * Bantumi.wellXSpacing ;
var y = WellNumber == 0 ? Bantumi.wellYSpacing / 2 : Bantumi.wellYSpacing ;
}
this.clip._x = x ;
this.clip._y = y ;
this.clip.onPress = function () { trace (this._name) ; }
// array to store seed instances
this.seeds = new Array();
// instantiate 4 seed objects
for ( var i=0 ; i<4 ; i++ )
this.seeds.push( new Bantumi.Seed( this , i) );
}
Bantumi.Seed = function ( Well , SeedNumber )
{
this.parentWell = Well;
this.clip = Well.clip.attachMovie( "seed" , "seed"+SeedNumber, SeedNumber);
}
myBantumi = new Bantumi.Game () ;
I will review the code in a few, just to see if I get it.
Question: Dont we have to wait and see where the wells will be placed in the electrongeek provided board? wouldnt we just place an “invisible” mc over the pic?
One thing, I had it set up in my code so that 4 seeds are attached inside each Well’s clip. But since the seeds will be rotated from one well to another, is it wiser to keep all seeds on a single timeline (as opposed to 14 different timelines)… I don’t know, what do you think?