0 Members and 2 Guests are viewing this topic.
If X1+W1>X2 AND X2+W2>X1 AND Y1+H1>Y2 AND Y2+H2>Y1there is a collision!ENDWhere X and Y are position and W and H are width and Height. As for collsion velocity tranfer, the equations are this:V1 = (C*M2*(V2-V1)+M1*V1+M2*V2)/(M1+M2)V2 = (C*M1*(V1-V2)+M2*V2+M1*V1)/(M2+M1)Where V is velocity, M is mass, and C is a constant from 1-0. 1 being a perfectly elastic collision (no energy lost) and 0 being a perfectly inelastic collision (objects stick together).
is that the ? mark when you make a new topic?
first, thx for the quick awnser, second, its a tile map of8-10so youre saying i need to do pxl-test?(im new and i dont now how to post code)
i'm code
01010101->GDB1010000010100000101010101
8->X24->Y{Y/8*4+(X/8)+GDB1} //returns tile number at pixel position (x,y)
Well, that works if you're using only B and W tilesYou can also check to see if the tile below you on the tilemap is movable or nonmoveable. This is substantially easier if either only one tile is moveable or only one tile is nonmoveable (moveable in this case meaning you can step on it)
Collisions depend on what you're making, but try using this to Tilemap:http://ourl.ca/4550If you're doing physics based game and you need really accurate physics, try Builderboy's routine (Which I hope he doesn't mind me posting):QuoteIf X1+W1>X2 AND X2+W2>X1 AND Y1+H1>Y2 AND Y2+H2>Y1there is a collision!ENDWhere X and Y are position and W and H are width and Height. As for collsion velocity tranfer, the equations are this:V1 = (C*M2*(V2-V1)+M1*V1+M2*V2)/(M1+M2)V2 = (C*M1*(V1-V2)+M2*V2+M1*V1)/(M2+M1)Where V is velocity, M is mass, and C is a constant from 1-0. 1 being a perfectly elastic collision (no energy lost) and 0 being a perfectly inelastic collision (objects stick together).
[01020202020202020203]->GBD1[04050505050505050504]...