Ok, I have been messing around with a concept for a week or so now. I have read every single page in the manual and browsed the forums for a solution to this but I suspect it's my own logical failings. I am not seeing something, or a function to make these things work, as if I don't have a missing link that will make all my ideas come together.
Here is a picture of the concept;
<img src="http://i.imgur.com/r8az4S2.png" border="0" />
And this is some of what I have tried/worked with;
-I have all of the objects created and ready to work with.
-one object called "spawner" that has four different instances
-----the spawner spawns a ball from a randomized instance every five seconds
-----I want the ball that it spawns to be one of four different colors. instead of just one.
-I have four different sprites for the balls of different colors (each is a different color sprite
-----the names of the balls are as follows; blueball, greenball, redball, yellowball.
-I also have one sprite called 'ball'
-----this object has four different animations that are named as follows; blue, red, green, yellow
-----each animation is a different looking sprite in its respective color.
-I make the balls pin to the bucket when they collide with it or other colored balls; This makes them not move in the bucket.
-----when two balls of the same color collide, they are destroyed,but I want it to take three of the same.
-----most people do this through a grid, but with the nature of what I am doing a grid won't work, because the balls can end up in various random places because they are not square like in a tetris clone.
-----so i need to somehow have the balls understand when they have touched three or more of their own color in a chain and then destroy all similar colors involved in the chain. this will in turn allow the balls above them to disconnect from their current pins and drop to a new position. (i know it sounds complex)
I understand this is probably a lot to understand, either that or it is far simpler than I expect and I just seem ridiculous explaining the drawn out methods.
The game actually happens on a bigger scale and quite differently than in the example I've given, but solutions to the example will give solutions in kind to my bigger problems.
I cannot for the life of me figure it out and have read many different posts on things that are somewhat similar, but just not the same.
Any help would be greatly appreciated.
I created a little sample program if it helps anyone understand a little better what I am looking for. Also, anywhere you note I can streamline actions let me know ;)
Here is the program:
Here is a Screenshot of its event sequence:
<img src="http://i.imgur.com/u06KGCy.png" border="0" />
I am still having this issue and was wondering if anyone could point me in the right direction. I have been reading the forums and read the entire manual and still cannot find a solution. Thanks.
I can haz capx
create a Subgroup inside the main group:
Ball is overlapping Ball Add 1 to BlueballVariable
Ball is overlapping Ball
if BlueballVariable bigger or equal than 3 - destroy
I still cannot figure it out, I am not an idiot, though I sure feel a fool. I changed the capx and tried a couple more things and what you suggested. Can you possibly take another quick look?
I only want balls to destroy when three of them are touching, and I want all three of them to disappear. I feel its my organization that is possibly messing it up?
I tried with "is overlapping object" and I tried with "on collision with object" I prefer the results I can get with "on collision" because this way, the moment they are in the bucket I can make them pin to each other, so they remain stationary in the bucket, until they are destroyed.
Here is the capx:
There very well could be a better solution, but I used a mask for each ball that has a larger collision polygon. Using this polygon, I could somewhat accurately detect groups of each ball color. Take a look:
A few things to note:
I hope this helps.
I made few edits to Zatykas approach, mainly I condensed all ball objects into single object which shrinks the whole event sheet down to 6 events. Heres the link:Catch-a-ball
Also removed the second bucket object and few other things I felt were not necessary :)
Thank you guys, this was what I was missing. I am going to integrate this into my game now. This caused me loads of frustration but now thanks to all of you guys, that frustration has been eased dramatically. Thanks
Develop games in your browser. Powerful, performant & highly capable.
This may be kind of a ridiculous question, but how do I pull up the system expression;
--> System - ball.pickedcount >=3
*** Edit, turns out I am a fool haha. I found it. I had already used it too. Jeez, brain fart. Thanks
I know, it happens