Bantumi coders!

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]

I was wondering why that function wouldn’t work… :stuck_out_tongue:

And this is getting messy :-\ I’m not sure I’m doing this the right way. Lost, do you have an about how we should set those **** wells in order ?

Well i’m not really the one to go to for non-messy coding so I don’t know.

However, I was thinking (after seeing how it looks now), would it be better to do this isometrically?

Probably, but that’s just presentation :slight_smile: 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!!!

Hehe, I still don’t actually understand how to play the game, so I will have to figure that out today :x

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 :slight_smile:

here goes my semi-commented code:

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);
}

Im not sure I followed the logic of the wells… My brain is fried right now, I’ll come back with a thought or two…

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?

I see he already answered the player question with “owner”. Each player has 7 wells, though… so code is not quite right, unless you’re starting at 0.

:slight_smile:

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 :slight_smile:

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 :slight_smile:

claps

:beam: That’s very nice indeed.

Im with you ahmed, and I was agreeing with the player class thingie :), even though I thought player would also be a property of wells

well.player
well.quantity
well.id (although this is not needed, since they’re named well1, well2, well3)

The well.owner property points to an instance of the Player class :slight_smile:
Well.quantity… hmm, I shoulda thought of that :stuck_out_tongue:

Wells are placed. What do you think?

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?

Actually, I declared to variables at the beginning of the script, wellXSpacing and wellYSpacing for that purpose :slight_smile:

Here’s the fla I have so far:

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?

I was thinking the same thing :slight_smile: [size=1]you know what they say about great minds… :beam: [/size]

By the way, I’ve added wellContainer clips, I forgot to mention it, and I put it in the parameter list of the well constructor.