puzzle help

Game Editor comments and discussion.

puzzle help

Postby Nykos » Sun Jul 17, 2011 8:27 pm

Hi, i've been searching the forums for leads on how to do a puzzle bobble like game. But I didn't find any exemples or simply didn't understand what was explained... :( . Basicaly, what i need is that at least two balls are destroyed when another one collides with it.

I tried some things by myself, like a variable on balls actors, the collision adds +1 to the variable and when it's =3; the ball destroys itself. It works, but it inly destroys the two balls in collision, and not the third. So I did this on destroy event:
Code: Select all
if(collide.color==color)
{
    collide.dest+=1;
}



but it doesn't work.

Does anyone have any idea how to do it? Watching on the forums, I saw that it would certainly be better to use an array, but honestly i didn't understand any of it...

Another thing I saw was hexagonal cells or something like this, you know, some code to have the bal automaticaly placed at a given coordonate, and not just where it collides. something like a grid. Any idea how to do it?

I know I've asked a lot lately, but as I have no work fort the moment, i have all my days to work on games, and i'd like to use as well as i can.

Thanks in advance, nykos.
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Re: puzzle help

Postby foleyjo » Mon Jul 18, 2011 11:08 am

Not sure exactly what you mean but if I Know puzzle bobble you fire a coloured ball at a bunch of balls. If that ball hits the same coloured ball then all the colliding balls of that colour will vanish.

So what I would consider is -

1 - Collision event between the ball fired and the ball hit which destroys the event actor and the collided actor
2 - On the destroy actor event of the collided ball do a get all actors in collision check and check each ones colour
3- if the colour matches the colour of the destroyed actor then destroy this actor too.

Because this is in the destroy actor event all the balls should inherit this the process should be continued until all the colliding balls of the same colour are destroyed.
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: puzzle help

Postby lcl » Mon Jul 18, 2011 11:48 am

I'm now going to show the script for doing what foleyjo suggested.

Put this into the ball actors Activation event from other ball actor and to the colliding event with the ball shot.
The code searches thorugh all the colliding actors, if it founds same coloured actors it sends them an activation event that makes them check their colliding actors.
After checking all the colliding actors, the actor itself will be destroyed.
Code: Select all
int i, j;
Actor * actors = NULL;

actors = GetAllActorsInCollision("Event Actor", &j);

if (actors)
{
    for (i = 0; i < j; i ++)
    {
        if (actors[i].color == color)
        {
            SendActivationEvent(actors[i].clonename);
        }
        if (i == j)
        {
            DestroyActor("Event Actor");
        }
    }
}
else if (!actors)
{
    DestroyActor("Event Actor");
}

Ask me for help if you don't understand the code or if it's not what you wanted or if it doesn't work for reason or other. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: puzzle help

Postby Nykos » Mon Jul 18, 2011 9:39 pm

Foleyjo: you understood well, that's exactly what i meant and your way to do it is really similar to how I wanted to do it. :D In fact I thought the checking could be done this way:
Code: Select all
if(collide.color==color)
{
    dest+=1;
}

and when dest==3, the ball destroys itself. But obviously, it's not the right way...


LCL: Thanks for the code man, I tried what you explained but it does not work. There are just no destructions.

Just to be sure i did everything as it was meant to be done:

I copied the code in ball's activation event (from actor"ball") and in ball's collision event with ball.(I just added a little physical response in collision event to avoid it going out of screen). But the ball sometimes destroys one ball, even if it's not the same color, and more often destroys nothing.

I will try to make it work today, but if you have some ideas of what I could do ...
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Re: puzzle help

Postby lcl » Mon Jul 18, 2011 10:59 pm

Hmm.. got to look at the code tomorrow.
Too bad I'm not at home currently and I can't use GE.
If I was able to use GE I could help you better.

But I will try to help. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: puzzle help

Postby foleyjo » Mon Jul 18, 2011 11:22 pm

Heres a little demo that appears to do the job.

However it is a little bugged.
Sometimes the balls don't seem to vanish but then when you shoot them again they are gone and the collision event doesn't work
Attachments
ball.png
ball.png (286 Bytes) Viewed 2251 times
balldemo.ged
(5.01 KiB) Downloaded 104 times
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: puzzle help

Postby Nykos » Tue Jul 19, 2011 5:08 am

thanks guys, i really appreciate the help. Foleyjoyour demo has another bug, it doesn't seem to create next ball, but i turned "create at start" on yes and mange to see it work, it's cool, this does just what i want. Thanks man, I will work on it today.
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Re: puzzle help

Postby Nykos » Thu Jul 21, 2011 9:15 am

Ok so here's what i've been able to do working with foleyjo's demo, i've changed some things: Added sprite from the jewel block demo, the color of the next ball is given by the previex actor, and some other little things i don't remember cause it was 2.PM...

It works not so bad, but there are still some issues or things i'd better like.

-DestroyMe is not always triggered to all same colored balls in collision, but i think maybe it's due to Zdepth. Am i right?

-For now, next ball destroys any same colored bal, even if it's one single ball. What would be very cool is that it destroys balls, on ly if there are already in collision with at least one another same colored ball. Maybe i could use an actor variable to tell the nextball if it is the case?

-Another thing would be that when a ball is isolated in the air, with nothing colliding it, it would fall. I tried to use Collision Free, but obviouslyi don't know how to use it cause every ball fell...

Any idea???

(I hope Iyou understand me cause my english is not perfect... :D )
Attachments
bubble.rar
(22.71 KiB) Downloaded 109 times
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Re: puzzle help

Postby foleyjo » Thu Jul 21, 2011 1:22 pm

Collision free is not a good option because it only checks the collision in one direction.

I think I may start work on a similar project because it seems like a challenge. I'll swap information with you once I get onto it.
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: puzzle help

Postby foleyjo » Thu Jul 21, 2011 6:40 pm

Hey Nykos

I got something nearly sorted which will do the basics of what you need for this. Just need to add one more function to it.
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: puzzle help

Postby Nykos » Fri Jul 22, 2011 8:18 am

Great man, can't wait to see it
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Re: puzzle help

Postby foleyjo » Fri Jul 22, 2011 1:39 pm

Struggling a bit here.

Can't work out how to get the balls to fall,

I have made a bar at the top and all balls not connected to this bar either directly or through another ball will fall.

However I'm not sure how to check this.

I can check all the balls directly connected to the bar but then how do I do all the other balls?
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: puzzle help

Postby foleyjo » Fri Jul 22, 2011 3:24 pm

This is what I got so far.

(Note: I have reuploaded this if anyone download the first file)
Attachments
ball.rar
(7.73 KiB) Downloaded 108 times
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Re: puzzle help

Postby Nykos » Fri Jul 22, 2011 5:19 pm

Thanks a lot Foleyjo, I'm studying right now, and iexactly what I want for the collision.
Now I have to understand it all... :D
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Re: puzzle help

Postby Nykos » Sat Jul 23, 2011 7:17 am

Foleyjo, I won't be home this weekend so I won't be able to work, but i studied your code and it's very cool.
I tried doing the same thing without the setup and checker actors but i realized they were not useless... :D .
But i found out that when a lot of balls are created from start, like the image:
you still have the habe two newballs collide with the clones to have it destroyed. So here's my question:
What can I do to have them destroyable from the beggining? I tried to use colourmatch++ in the create event, then in draw event, but it didn't work.
Once again, THANK YOU for the help, i really really appreciate.

Nykos
Attachments
Untitled-2 copy.jpg
Nykos
 
Posts: 110
Joined: Sun Dec 19, 2010 11:11 pm
Score: 6 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest