asteroids-cs165/flyingObject.cpp
2020-06-30 20:04:55 -06:00

21 lines
432 B
C++

#include "flyingObject.h"
#include <iostream>
// Advance flyingobjects
void FlyingObject::advance()
{
point.addX( getVelocity().getDx() );
point.addY( getVelocity().getDy() );
if ( point.getX() > 200 )
point.setX( -200 );
else if ( point.getX() < -200 )
point.setX( 200 );
if ( point.getY() > 200 )
point.setY( -200 );
else if ( point.getY() < -200 )
point.setY( 200 );
}