Random Spawners and Object type collisions

0 favourites
  • 11 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • 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.

    Thanks

    -adam

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

    docs.google.com/file/d/0B-YaB0xL6KK2M2RpM0pMU2V0bnc/edit

    Here is a Screenshot of its event sequence:

    <img src="http://i.imgur.com/u06KGCy.png" border="0" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    docs.google.com/file/d/0B-YaB0xL6KK2NEZFRXhyOEhjZk0/edit

  • 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.

  • 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

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)