-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBullet.cpp
More file actions
47 lines (33 loc) · 1002 Bytes
/
Bullet.cpp
File metadata and controls
47 lines (33 loc) · 1002 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
//
// Bullet.cpp
// RiverRaid
//
// Created by Noor Bafageeh on 11/22/16.
// Copyright © 2016 Noor Bafageeh. All rights reserved.
//
#include "Bullet.h"
#include "Asset.h"
#include "string"
#include "RRApp.h"
#include "RRMap.h"
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include <iostream>
using namespace std ;
class RRApp;
class Asset;
Bullet::Bullet(RRApp * app, SDL_Window *window, SDL_Renderer *renderer, Asset *player)
: app(app), window(window), renderer(renderer){
SDL_GetWindowSize(window, &width, &height);
SDL_Surface *loadedImage = IMG_Load("img/bullet.bmp");
if(loadedImage==NULL ){
cout<<"Error loading plane img "<< IMG_GetError();
}else{
bullet = SDL_CreateTextureFromSurface(renderer, loadedImage);
rect2.w = 100;
rect2.h = 100;
rect2.x = player->rect1.x + 35;
rect2.y = player->rect1.y;
}
fireBullet = false;
}