Random Spawners and Object type collisions

Get help using Construct 2

Post » Thu Feb 28, 2013 10:07 pm

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;



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.

Thanks
-adam                             nickervision2013-02-28 22:21:21
B
5
S
1
G
1
Posts: 13
Reputation: 610

Post » Fri Mar 01, 2013 12:45 am

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:
https://docs.google.com/file/d/0B-YaB0xL6KK2M2RpM0pMU2V0bnc/edit?usp=sharing

Here is a Screenshot of its event sequence:
nickervision2013-03-01 00:53:43
B
5
S
1
G
1
Posts: 13
Reputation: 610

Post » Wed Mar 06, 2013 10:13 pm

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.
B
5
S
1
G
1
Posts: 13
Reputation: 610

Post » Wed Mar 06, 2013 11:23 pm

I can haz capx
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Wed Mar 06, 2013 11:27 pm

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
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Wed Mar 20, 2013 11:41 pm

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:
https://docs.google.com/file/d/0B-YaB0xL6KK2NEZFRXhyOEhjZk0/edit?usp=sharing
B
5
S
1
G
1
Posts: 13
Reputation: 610

Post » Thu Mar 21, 2013 4:31 am

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:

Bucket Test

A few things to note:
  • I used the first demo you posted because I found it easier to work with.
  • I changed the drop rate to every .5 seconds because it was painfully slow to test when 1 ball drops every 5 seconds. Changing it back to 5 seconds should not be any problem.
  • I added a few notes to explain what I did.
  • I left the masks visible, but just so you could see what's going on. I'd normally set them to be invisible.
  • A lot of the code in the files you posted is redundant. I noticed in the 2nd capx you posted, you consolidated the different colored balls into a single object, which is good, but you're still duplicating the same couple events for each color. It won't stop your code from working, but it's just good practice to consolidate your code. You could probably run a loop for all the balls, and change the specific color you're looking for within each loop.


I hope this helps.
B
44
S
13
G
7
Posts: 338
Reputation: 10,379

Post » Thu Mar 21, 2013 7:36 am

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

B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Thu Mar 21, 2013 6:01 pm

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
B
5
S
1
G
1
Posts: 13
Reputation: 610

Post » Thu Mar 21, 2013 6:53 pm

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. Thanksnickervision2013-03-21 18:55:45
B
5
S
1
G
1
Posts: 13
Reputation: 610

Next

Return to How do I....?

Who is online

Users browsing this forum: DiabloOvermind, emoticon, MrWhizm, WhosWho and 18 guests