Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Feb 2013
Offline Last Active Feb 28 2013 12:20 PM

Posts I've Made

In Topic: SFML Missile Speed

23 February 2013 - 08:04 PM

You'll need to also include the X component:

That is what I did initially but it behaved differently from what I was expecting.


To decide the velocity for a missile, it's a simple X=R*cos(angle), Y= R*sin(angle).

I think that is what I was looking for.I should have thought of that lol.


This code is a bit of a code smell. If you want to have a variety of rocket behaviors, you may want to consider inheritance here.

I applied inheritance for some other basic stuff but not for missile behaviours.

This is my first game with c++ but I think I know what you mean.

I should basically move the:

if(missile->getType() == Missile::Player){
// Missile angle of player is only vertical
} else {
// This part needs to change from vertical to angles of 45,90,135 degrees
// sprite.move(0,missile->getVelY()*refreshRate);

inside the missile class. Am I correct?