File: Player.cc

package info (click to toggle)
hannah 1.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,712 kB
  • ctags: 281
  • sloc: cpp: 2,210; sh: 214; makefile: 117
file content (30 lines) | stat: -rw-r--r-- 515 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "Player.h"


Player::Player(char *name, AnimationFactory* af) : Sprite(name, af){

};

//Player::~Player(){
//	int i;
//	printf("Killing sprite\n");
//	for(i=0; i<animations.size(); i++){
//		free(animations[i]);
//	}
//};

void Player::move(){
	if(xpos < nextxpos){
		xpos = xpos + speed;
	} else if(xpos > nextxpos){
		xpos = xpos - speed;
	} else if(ypos < nextypos){
		ypos = ypos + speed;
	} else if(ypos > nextypos){
		ypos = ypos - speed;
	}
};

void Player::respawn(){
	setAnimation("default");
};