-
Notifications
You must be signed in to change notification settings - Fork 2
/
asteroid.cpp
34 lines (28 loc) · 859 Bytes
/
asteroid.cpp
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
31
32
33
34
//
// Created by Xoncry on 26.11.2017.
//
#include <iostream>
#include "asteroid.h"
sf::Texture* asteroid_texture_ptr;
asteroid::asteroid(int health, float xpos, float ypos) {
asteroid_texture_ptr = &asteroid_texture;
asteroid_texture.loadFromFile("Assets/asteroid-big-0000.png");
this->rect.setTexture(asteroid_texture_ptr);
this->rect.setPosition(xpos,ypos);
this->health = health;
this->CollitionDamage = 50;
this->rect.setSize(sf::Vector2f(100,100));
this->rect.setOrigin(45,45);
//this->rect.setSize(sf::Vector2f(player_texture_ptr->getSize().x, player_texture_ptr->getSize().y));
}
asteroid::asteroid() {
this->rect.setPosition(0,0);
this->health = this->maxHealth;
}
void asteroid::ProcessEvents(sf::RenderWindow* window) {
if(i==180){
this->velocity.y += 1;
i = 0;
}
i++;
}