forked from krushikar543/CPP-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoin.cpp
More file actions
56 lines (56 loc) · 999 Bytes
/
coin.cpp
File metadata and controls
56 lines (56 loc) · 999 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "coin.h"
void coin::Render(SDL_Renderer *ren){
//timer++;
//if(timer < 10){
SDL_RenderCopy(ren, this->get_texture(), NULL, &dest);
//}
//else if(timer < 20){
// SDL_RenderCopy(ren,tex2,&src,&dest);
//}
//else{
// timer = 0;
//}
}
void coin::move_coin(){
//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,y,30,30);
i++;
}
else{
set_dest_values(x,y,30,30);
i++;
}
//SDL_RenderCopy(ren,this->get_texture(),&src,&dest);
//move(ren);
}
void coin::move(){
if((jump_timer - last_jump) > 1000){
last_jump = jump_timer;
}
else{
move_coin();
}
}
void coin::set_jump_timer(){
jump_timer = SDL_GetTicks();
}
//void coin::CreateTexture2(const char* address, SDL_Renderer* ren){
// tex2 = texturemanage::texture(address, ren);
//}
void coin::set_x_value(float x_val){
x = x_val;
}
void coin::set_y_value(float y_val){
y = y_val;
}
float coin::get_x_value(){
return x;
}