Posted By
|
Message
|
siven I EAT ROCKS
Registered 03/11/2008
Points 604
|
7th February, 2014 at 07/02/2014 05:10:49 -
so ive tried and i cant seem to figure it out. how do you make a group of objects, say enemy drops, that when they fall on the ground next to another one it pushes them apart so you cant pick them up at the same time?
[Game design makes my brain feel like its gonna explode.]
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
7th February, 2014 at 07/02/2014 05:52:31 -
This is a tough one.
I'd say it depends on how you're spawning the enemy drops.
You could have a timer that determines whether a drop is "settled" or not. When the drop spawns it can start counting up to a certain value, and once that value is reached it can no longer be pushed. Then if a new drop spawns on top of it that one can either move to the left or the right of it based on a random number or something else.
Of course the best way would be to use the for-each object to manage each of the drops independently.
Drops could check if they're overlapping another drop and if they are calculate the distance and angle from the other drop and use that to determine how much "push" should be applied.
You might have to do two nested for-each loops for it to be perfect since you'd want to account for instances where more than two drops are overlapping and instances where drops are right on top of each other.
n/a
|
Chris Donovan
Registered 15/06/2003
Points 448
|
7th February, 2014 at 07/02/2014 05:54:38 -
As a starting point, give each of the objects the bounce movement, set their deceleration values to 20, and speed to 0. Add each one to the same qualifier (Good in the example), and set the following condition:
If Good Qualifier overlaps Good Qualifier then set speed to 20 and bounce.
This will have them bounce randomly if they are overlapping. You will have to fine tune the rest to get what you want or try a different route.
Send me feedback on my latest game, It Never Ends.
http://www.misterdonovan.com/it-never-ends/info/
|
UrbanMonk BRING BACK MITCH
Registered 07/07/2008
Points 49667
|
7th February, 2014 at 07/02/2014 05:56:47 -
Actually I just thought of another suggestion, I was going to edit it into my previous post, but a reply was made.
You could make the drops fit to a grid, when they spawn have them check if their spawn location already has an item. If it does scan on either side of the location till an empty spot is found and then move to that location using linear interpolation or similar. Infact this is the method I'd use. Heck you could even make a limit to the number of drops and have it destroy the oldest drops after the limit is reached.
n/a
|
Fifth Quadruped
Registered 07/05/2003
Points 5818
|
7th February, 2014 at 07/02/2014 08:05:06 -
Are we assuming a top-down perspective? So the settled objects are colliding on a two-dimensional plane? You could probably put together a simple collision system to have the items push each other away. But even the simplest of collision systems can be a lot of work.
The way that I think would work here would involve a qualifier group for the collidables, and a master object to hold a few extra variables.
Each object in the collidable group would need a few dedicated variables:
A - Accumulative push X
B - Accumulative push Y
C - ID number
D - Collision radius
E - Distance test
What you do is first spread the value 0 in the ID number to give each collidable a unique value, then start a loop for the number of collidables there are. On each loop, you find the one collidable whose ID matches the loop, and assign its X position, Y position, and "Collision radius" to the master object.
Next, in a single event, you assign each collidable's "Distance test" value to the distance between the object's position and the master's stored position, minus ( the object's "Collision radius" plus the master's stored "Collision radius"). And if a collidable object's "Distance test" is lower than zero, then there's a collision, and you add the overlapping distance to its "Accumulative push" values.
Once the loop is through, you add the "Accumulative push" values to each object's position, and clear the values.
It's a relatively fast method, as it only needs to loop for as many objects there are (instead of something like the number of objects squared), but it will still slow down after a point.
...And I'll try to throw together an example tomorrow, 'cause that was probably pretty confusing.
Go Moon!
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1971
|
7th February, 2014 at 07/02/2014 17:21:58 -
Use physics extension (eg. box2d) - the maths is absolutely mind-boggling otherwise.
n/a
|
siven I EAT ROCKS
Registered 03/11/2008
Points 604
|
7th February, 2014 at 07/02/2014 20:44:27 -
I like urban monks second idea with making it grid based. this is not a top down game, this is a sidescroller shooter. the main reason for this is that if two guns are overlapping each other when you pick it up it will pick up both guns and fuse the stats together to get (sometimes) Freakishly powerful weapons. like a machinegun that shoots grenades, or a shotgun that shoots rockets. would it be easier to make something to randomly pick one of the guns when it is overlapping 2?
[Game design makes my brain feel like its gonna explode.]
|
Fifth Quadruped
Registered 07/05/2003
Points 5818
|
8th February, 2014 at 08/02/2014 00:27:33 -
Well, if that's the only issue, just add the "Pick object at random" condition. Problem solved!
Go Moon!
|
siven I EAT ROCKS
Registered 03/11/2008
Points 604
|
10th February, 2014 at 10/02/2014 02:12:15 -
*Facepalm* ill give that a try
[Game design makes my brain feel like its gonna explode.]
|
Rick Cameron
Registered 11/03/2012 08:45:25
Points 82
|
10th February, 2014 at 10/02/2014 08:15:59 -
Originally Posted by siven I like urban monks second idea with making it grid based. this is not a top down game, this is a sidescroller shooter. the main reason for this is that if two guns are overlapping each other when you pick it up it will pick up both guns and fuse the stats together to get (sometimes) Freakishly powerful weapons. like a machinegun that shoots grenades, or a shotgun that shoots rockets. would it be easier to make something to randomly pick one of the guns when it is overlapping 2?
It might be just me, but that sounds amazing.
n/a
|
siven I EAT ROCKS
Registered 03/11/2008
Points 604
|
10th February, 2014 at 10/02/2014 21:44:56 -
yes its quite amazing... but waaaay over powered and makes the game no fun sadly lol. also, when the full game comes out i want the gun system to be glitchless so gameplay is smoother and less confusing. although, i probably will make a really rare weapon that does what some of the glitch guns do cuz they are pretty sweet lol.
[Game design makes my brain feel like its gonna explode.]
|
|
|