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

1 decade ago by motoko

I have tilesize 8, and i have entities from size 16,8 that should have the collides attribute set to FIXED.

The problem i have is i want to place more than one of these entities together. They are both on their own 'tiles', they are not moving nor colliding. But they are placed in weltmeister so that there are also no pixels between them.

When the game starts all the entities, start colliding and destroying themselves... i have changed the size to 15,7 while showing a 16,8 sprite, but that makes the player can hit just in the pixel between them hitting both and i don't want that.

If i use the collides:fixed option, then the entities dont dissappear, but they 'move' when the player hit them and they shoudn't.

¿What should i do?

1 decade ago by motoko

Will make a poll :P

1 ¿Nobody knows how to solve this?
2 ¿You don.t understand anything because of my bad use of english?

1 decade ago by motoko

I have made a tiny image trying to explain better what i'm experiencing. b1,b2,b3 and b4 won't never move.

/><br />
<br />
In first case the problem is p1 can collide with b1 and b2 if it hit's between them.<br />
<br />
In the secod case the problem i'm eperiencing is that when i load the game b3 and b4 collide each other (i think they should not) and one of them, dissappears.<br />
<br />
I don't want the puck being able to cllide two blocks..			</div>
			<div class=

1 decade ago by dominic

You english is just fine, don't worry.

What you encountered is actually a "quirk" in Impact. The Entity&039;s #.touches() method does not only check for overlaps, but also for adjactent entities as well. This method is used for checks and collisions.

I'm hesitant to change it in the core library, because it may break some existing games and the method name ("touches") really is ambiguous. But you could overwrite this method in your Entity class, so that it will only check for overlapping entities:
touches: function( other ) {		
	return !(
		this.pos.x >= other.pos.x + other.size.x ||
		this.pos.x + this.size.x <= other.pos.x ||
		this.pos.y >= other.pos.y + other.size.y ||
		this.pos.y + this.size.y <= other.pos.y

(Note the <= and >= instead of < and >)

Edit: one more thing: why do the blocks actually check each other? Shouldn&039;t they only be destroyed when they're hit by the ball, as they shouldn't hit each other anyway? I.e. if you give your Block entity the #.type ig.Entity.TYPE.A and only let them .checkAgainst ig.Entity.TYPE.B (the ball), the check method will not be called, even if two blocks are touching, but only when the ball is touching them.

1 decade ago by motoko

Thank you for the response!

I was experimenting with with the types, the checkagainst, and the collide types properties this morning, but i couldn't find the correct combination. I understood it as i readed it in the doc (or i think i did), but i will try again tomorrow, i assume i have done something wrong, or using the collidewith property in a weird manner.

If it doesn't work i will overwrite the touches method as you sugested.

1 decade ago by motoko

Hi again,

I have discovered why the '.checkAgainst thing' isn't working properly for me. The blocks have life, you must hit them x times before they are destroyed and I'm using the .collideWith method in the blocks, to detect witch entity hits them and if it's the puck, they receive damage and eventually get destroyed.

I have changed the method for the check one. If i change it, the 'type'-'checkAgainst' strategy works, but when my bolcks receive the last 'hit' the puck doesn't collide at all, the block gets destroyed and the puck collides with the bolck behind the one that was destroyed (if it has more than 1 point life left).

But when i return to the collideWith method, the blocks destroy themselves while touching, no matter witch type they are and who should they checkAgainst.

Rewriting the touches method worked like a charm. The case when the puck hit's two blocks has decreased, but still occurs. I think it's because the puck isn't really round and it really can hit two blocks at once i will return to this when i have advanced in other things.

Thanks again.
Page 1 of 1
« first « previous next › last »