0 Members and 2 Guests are viewing this topic.
So for mathematical collision (which is a must if you are not going the pixelTest way) you just go through several parts of an If Statement.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). Note that when the masses are the same and C=1, the velocities of the objects are swapped. These equations are what i just implemented into Zedd, and they work quite well
I don't mind at all ^^ And probably the biggest question is; Do you only have objects colliding with the map, or do they also collide with eachother?
Repeat getkey(15).Game Logic, movement engine, et cetera. A bunch of crap that works, basically.ClrDraw.Draw the tilemap only, not the character or anything.After that is done....set some temporary variables.Y/256->AX/2048->B.X is divided by 256 and then by 8 (256*8 = 2048)If {A*12+B+L6)=255 or ({A+1*12+B+L6}=255) or ({A+2*12+B+L6}=255) or ({A+3*12+B+L6}=255) or ({A+4*12+B+L6}=255).bounceEndEnd
Quote from: Builderboy on September 03, 2011, 04:53:11 pmHoly crap.