Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by dahl

.standing - Boolean, stating if the entity is resting on the ground (y axis).

Is "ground" the literal ground as in the weltmeister?

or

Is "ground" whatever the entity is "resting" upon? ie:

_____
| |
| Box A |
|____|
| | Is Box A "resting" ( .standing ) on Box B?
| Box B |
|____|

Thanks!

1 decade ago by Jerczu

Hmmm.... write a test case in your box entity and check what it returns the best way to learn and get your answer.

1 decade ago by dahl

Sorry, but what is the correct syntax to use the '.standing' property? and thank you for responding to my post.

1 decade ago by Jerczu

As I said the best way is to write a test case or simply investige the entity.js you will notice that .standing means resting on the collision layer and it seems (after a very quick looksee - so don't take it as a definite) also the standing property is also true once the rested on other entity so I would think your understanding is right.

1 decade ago by Jerczu

I don't know if I understood properly what you are asking for - you dont have to set this property this is returned once the entity in a resting state.

1 decade ago by dahl

gotcha! that is what i was looking for. tyvm. i thought you could set it.

1 decade ago by Jerczu

No problem...

1 decade ago by dahl

ok, so i've been working on this for a few days now. I managed to get the hang of .standing, but where i'm still having trouble is how to "stack" objects on top of each other through gravity. I'm envisioning a situation where objects fall from the sky to the ground. IF they fall on top of one another, how do i get them to stack? I tried different .TYPEs, that didn't do it, then just offset through the floor, lol they are stacked, but stacked through the floor. If anyone knows a setting or workaround for this it would be great!

thanks.

1 decade ago by dominic

Dahl, it sounds like you want to build a puzzle game (like tetris or something) with Impact physics. Don't do this.

Physics simulation is a bad idea for puzzle games where really accurate positioning is required. This video, though meant as a joke, shows this beautifully.

So, I suggest you use an ig.BackgroundMap for your playing field. You can access the .data Array of that background map directly an modify it as needed. Just have all the "resting" parts of your game as tiles in your background map and use ig.Entity only for the currently active parts - if any.

Tell us a bit more about your game and I can probably give you some more ideas.

1 decade ago by dahl

well it was basically a gem matching type game. match 3+ for points and such. I was using the physics trying to get the objects to do as much of the work as possible. it was going pretty well till this point. i have small objects that drop pieces from the sky, they land, vel.x is 0, so that it falls straight down. like i said. the only issue atm is entities not stacking on each other. but i guess i'll give that .data a try. lol i'm just not too good with the array, as far as getting it to look stuff up. thanks for your response though.

edit: Yeah Dom........ in that video they did not alter the 'vel.x' of the blocks. if they did, it would have fallen straight down, b/c it has 0 movement along the 'x' axis. and my game would not need to turn them, just swap them back and forth with drags.

anyways off to check out that .data thing.

1 decade ago by Jerczu

What if you disable the gravity and bounciness then you could position your entities anywhere you would like.

Also if you get into it you would notice that collision resolution is a bit off (which I noticed just recently) especially if your entity is the same size as collision tile - if your entity lets say is 10x10 and tiles are 10x10 in an empty space that 10x10 your entity wont fit. You will have to reduce the size of it for collision to be resolved properly even though you would expect your entity to fit in perfect.

1 decade ago by dahl

well i just now got them to stack, they would not last night. the first one would hit the ground, the second one would pass through it AND the ground, then they would stack. but now they stack perfectly. lol i think it was chrome. b/c i changed no code. at least i hope that is all it was.

thanks for your replies guys.
Page 1 of 1
« first « previous next › last »