-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuilding.cpp
More file actions
40 lines (39 loc) · 811 Bytes
/
building.cpp
File metadata and controls
40 lines (39 loc) · 811 Bytes
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
35
36
37
38
39
40
#include "building.h"
void building::Render(SDL_Renderer *ren){
SDL_RenderCopy(ren,this->get_texture(),NULL,&dest);
}
void building::set_jump_timer(){
jump_timer = SDL_GetTicks();
}
void building::move_pipe(){
if(jump_timer > 10000){
x -= 3;
}
else{
x -= 1;
}
//set_dest_values(0,0,50,82);
static int i=0;
if(i%2 == 0){
set_dest_values(x,SCREEN_HEIGHT/2,SCREEN_WIDTH/15,SCREEN_HEIGHT/2);
i++;
}
else{
//set_dest_values(x,0,SCREEN_WIDTH/25,SCREEN_HEIGHT/2-50);
set_dest_values(x,2*SCREEN_HEIGHT/5,SCREEN_WIDTH/15,3*SCREEN_HEIGHT/5);
i++;
}
//SDL_RenderCopy(ren,this->get_texture(),&src,&dest);
//move(ren);
}
void building::move(){
if((jump_timer - last_jump) > 1000){
last_jump = jump_timer;
}
else{
move_pipe();
}
}
void building::set_x_value(float x_val){
x = x_val;
}