Leftium
Reputation
3,532
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
 Oct 22 comment Rotating sprite around another sprite Just recalled some billiards knowledge that simplifies the impulse point: the point of collision with the cue does not really affect the angle of the cue ball, only its spin. So you can set the impulse point as the center of the cue ball. Anyways, your pool game currently only allows hitting the cue ball in the center, so there would be no spin. (If you want, you could manually add spin based on the offset of the cue stick.) Oct 18 comment Rotating sprite around another sprite Don't use the position of the cue. Use the fact the collision happens on the stationary ball (which is a perfect circle). You already know the angle from the cue's orientation (might have to use some trig to get the actual angle). Apr 11 comment Collision Resolution @AntonChikin: Kodicek's collision resolution algorithm only takes three inputs: mass, velocity, and normal at the point of collision. Kodicek always calculates the normal at the point of collision when detecting collisions. He explains many different types of collision detection, including a box hitting another box. Just plug in that collision detection algorithm into the collision resolution algorithm. See chapters 8-10 of Kodicek's book for a full explanation. (Note rotational physics requires more math, which is also covered later in the book...) Jul 7 comment Efficient data packaging for a client-server network @Gerstmann: Raknet is open source (once again): github.com/OculusVR/RakNet Feb 6 comment Resolving a collision with forces @Vee: Good questions! Three+ bodies and static bodies are two separate issues. I addressed both in an update. Summary: handle collisions two objects at a time; static bodies have very large, infinite mass. Dec 2 comment Full screen blackout using allegro in codeblocks Yep, that was my second guess: allegro.cc/forums/thread/611484. You can't have more than one main() function in a single project. Looks like you figured it out... Nov 23 comment Full screen blackout using allegro in codeblocks @ArmandoOrtiz: I think your first program (and not your second program) is getting executed. Easy way to confirm: use `GFX_AUTODETECT` in the first file, and `GFX_AUTODETECT_WINDOWED` in the second file. If the whole screen goes black again, you are running the wrong program! Mar 21 comment C# Collision test of a ship and asteriod, angle confusion A picture would help other people understand your source code. Can you take a screen capture of your program and label what the various variables represent? (`asteroid_angle`, `ship_angle`, `angle_between`, `ship_angle_left`, `ship_angle_right`, `angle_between_left`, `angle_between_right`) Also please clarify which directions the X and Y axes go in your game and whether 'left' is supposed to be clock-wise or counter-clockwise. Oct 20 comment Why does my position interpolation code result in “jumpy” motion? Make sure the interpolation code is the actual cause: does the same jumpiness still (not) occur if you comment out the bodies of `smoothStates_()` and `resetSmoothStates_()`? Sep 25 comment Equation to make small number big and big number small (gravity) @Isaiah: The key part is `1/r^2`, which gives you "a number that rises as the distance decreases". To apply this force F to your `speed`, use physics: `speed = speed + F/mass` (because F = mv; v = F/m | where v = velocity (speed) and m is mass of object that force is being applied to.) Sep 18 comment Collision Resolution @ashes999: link fixed now! Jul 14 comment 2D Platformer AABB collision problems +1 for working code sample (missing horizontally moving "spike" blocks, though :) Jul 13 comment 2D Platformer AABB collision problems @Vee: The XNA demo already seems pretty close to what you want. How about modifying the demo into your game? (Add moving spikes to the demo, instead of bolting on parts of the demo to your game.) I think by copying only parts of the demo, there are some incompatibilities with the logic (like the jumping algorithms are different.) Jul 11 comment 2D Platformer AABB collision problems @Vee let us continue this discussion in chat Jul 11 comment 2D Platformer AABB collision problems @Vee: Can you show your code for jumping and `IsAffectedByGravity`? Jul 11 comment 2D Platformer AABB collision problems @Vee: your code doesn't show how `onGround` is set, so I can't investigate why jumping is incorrectly allowed. The XNA demo updates its analogous `isOnGround` property inside `HandleCollisions()`. Also, after setting `Velocity.Y` to 0, why does gravity not starting moving the player down, again? My guess is the `onGround` property is improperly set. Take a look at how the XNA demo updates `previousBottom` and `isOnGround` (`IsOnGround`). Jul 11 comment 2D Platformer AABB collision problems @Vee: set `Position = nextPosition` immediately inside the `for` loop, otherwise the unwanted collision resolutions (setting `onGround`) still occur. The player should be pushed vertically down (and never up) when hitting the ceiling thus `onGround` should never be set. This is how the XNA demo does it, and I cannot repro the "ceiling" bug there. Jun 11 comment Experience embedding javascript Be aware the Node.js Windows port is not ready; it's under development: stackoverflow.com/questions/6061053/… Jun 7 comment Variable height jumping in side scrollers +1 Leave gravity alone. May 13 comment Determine position of a rotated element in Tetris @bummzack: Well, then just use the same table for all the blocks like the DTET system. It simply tests more locations besides left and right. You can create your own system and check however many positions you want. However, using the same table for all pieces might allow "unnatural" wall kicks.