Quick Programming Tip: Rotate Actor to Face and the Perp Dot Product

Quick Programming Tip: Rotate Actor to Face and the Perp Dot Product

Here’s a new occasional series: Quick Programming Tips! These we’ll usually be a question for a small problem, and the solution with explanation for it.

The Question:

Here’s the first one! How do I rotate progressively a entity to face another entity? For example, you have two entities Red and Blue. You want Blue to attack Red, but Blue is not facing Red, but the opposite side.

Blue is facing the opposite side.

Blue is facing the opposite side.

Obviously, if Blue attack Red without facing him, it will not look good at all. So he has to look in the direction of Red to properly attack him.

Continue reading →

Share this:
Coding top-down movement with Box2D (and a new project)

Coding top-down movement with Box2D (and a new project)

Sometimes you decide you want to code a specific game genre once in your life, and until you develop something like what your mind pictured, you’ll be a slave of your mind. Nothing more will be done until you fulfill your inner gamedev wishes!

That’s the story of me. I always loved Top-down action games. Be it an ARPG like Legend of Zelda series, a brawler like Super Bomberman or a car stealing nirvana like PlayStation 1’s GTA 2, I love’em all. Instigating, I never tried to code one… Until now.

Continue reading →

Share this: