Page 1 of 1

Bubble Help

PostPosted: Thu Jan 15, 2009 4:31 am
by jimmynewguy
I need some help with the bubble breaking game i decided to make. The bubbles only break sometimes and the chain doesn't continue on... can some body please tell me what i did wrong this time? :D Thanx in advance!

Re: Bubble Help

PostPosted: Thu Jan 15, 2009 8:01 am
by DST
Hey, I love this game! I've been trying to make it myself, but its very challenging. My method is very different from yours, but one aspect of my game will improve yours i think.

First you make an actor kinda like the bubble, only with four 'arms'. It would be a plus sign with the arms extending a few pixels beyond the bubble.

Now when you click a bubble, do this:
Have the bubble create the cross actor, create a timer for itself, and set currentcolor(global integer) and
pressed(actor integer);
CreateActor("cross", "cross", "no parent", "no path", 0, 0, true);
CreateTimer("Event Actor", "timername", 50);
currentcolor=animpos;
pressed=1;


now on the cross actor>collision with any side of bubble
if (collide.animpos==currentcolor && collide.pressed==0)
{
DestroyActor("Collide Actor");
correctcolor=currentcolor;
}

Bubble>timer
if (pressed==1 && animpos==correctcolor){
DestroyActor("Event Actor");
DestroyActor("crossactor");
}
else
{
pressed=0;
currentcolor=10;
correctcolor=10;
}


and on bubble>destroyactor
if(pressed==0){
CreateActor("cross", "cross", "no parent", "no path", 0, 0, false);}


What this does:
if the first bubble's cross doesn't find any matching colors around it, no bubbles get destroyed at all.
if it does find a matching bubble, it destroys it and signals that a match was found(correctcolor).
the original clicked bubble waits for its timer, and if its the correctcolor, destroys itself, and all the crosses too.

the variable 'pressed' distinguishes the clicked bubble from all the rest.

The cross actor basically seeks out matching colors surrounding; it won't destroy anything that isn't 1. the right color or 2. not adjecent to the bubble group that's being scored.



Another neat trick is to say, on bubble>createActor (color is actor integer)
color=rand(x);
animpos=color;


Then use collide.color in place of collide.animpos. What does this do, well lets say you have 8 colors. By setting x to a number from 1-8, you can increase the difficulty of the game.

I hope this works for you, you can always ask if you want clarification on something.

:P

Re: Bubble Help

PostPosted: Thu Jan 15, 2009 12:47 pm
by jimmynewguy
see i thought about the cross idea, but then I thought to maybe post it here to see if anyone else had ideas thanx guys