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 hallsofvallhalla

I have it where the player can spawn a block on the mouse cursors location. The block is just a entity inside the player.js. The problem is I cannot get it to collide with player. The player walks underneath it. Tried changing the z index and several ways of collision.

player
collides: ig.Entity.COLLIDES.PASSIVE,

block entity
collides: ig.Entity.COLLIDES.FIXED,

any ideas?

1 decade ago by hallsofvallhalla

okay so I fixed the issue with spawned entity above the player with changing the zindex to -10 then
ig.game.sortEntitiesDeferred();

problem is they still wont collide! I cannot figure this out. Is there something I am missing? Is there a way to debug it to tell why not?

try it at
http://indie-resource.com/zgta/index.html
You can hit T and Y to place bricks and wood. Also you can use P to place a door then right mouse click to open it.
B opens menu

why in the world will they not collide?

1 decade ago by hallsofvallhalla

i am lost on this one. I cannot get spawned entities collides: to work. Anyone else have this issue?

1 decade ago by LaserBeam

Try:

Player TYPE.A, checkAgainst NONE, collides PASSIVE.
Box TYPE.B, checkAgainst TYPE.A, collides PASSIVE.

1 decade ago by hallsofvallhalla

collides PASSIVE vs collides PASSIVE will not collide.

1 decade ago by LaserBeam

I thought it would work, together with the check function. However I just tried it, in a fast test, and it did not. I then changed just the values of the box to:
type NONE, checkAgainst NONE, collides ACTIVE
And then it worked.

1 decade ago by hallsofvallhalla

I appreciate the help.
That does not work for me, are you spawning the box? What is your player set to?

1 decade ago by LaserBeam

Yes I spawned the box and the player is set to: type A, checkAgainst NONE, collides: PASSIVE.

1 decade ago by hallsofvallhalla

OMG what a silly error! I figured it out and now feel like an a$$

my update function was missing
this.parent();

go figure...anyways maybe I will save someone else hours of coding time :)

1 decade ago by gxxaxx

Don't feel too silly.

The way I figure it, 95% of my errors can be attributed to:

missing parent(),
using a comma when a semi-colon is called for,
using a semi-colon when a comma is called for.
using a comma after the final element in an array or object.

My big OMG moment was when trying to figure out why I could not kill a bat. Put some code in the kill method and forgot the parent(). Haven't done that since thankfully.

1 decade ago by hallsofvallhalla

haha yes this is my one gotcha that will be my first thing I check going forward :)
Page 1 of 1
« first « previous next › last »