platform-test/source/entity/powerup.cpp

23 lines
499 B
C++

//Powerup class body
#include"powerup.h"
Powerup::Powerup(int x, int y, SDL_Renderer** render,Player* player, int cameraX){
rect = {x,y,20,20};
renderer = render;
type = 2;
//New SDL_Rect to make the objects follow the camera
SDL_Rect cameraFix = rect;
cameraFix.x -= cameraX;
//Set render color and render the rectangle
if(player->check(rect,type)==0){
SDL_SetRenderDrawColor(*renderer,0xFF,0xFF,0,0xFF);
SDL_RenderFillRect(*renderer,&cameraFix);
}
//posu->check(rect, type);
};