Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Engine/engine.cpp
- Committer:
- Neowless
- Date:
- 2020-05-15
- Revision:
- 1:48b0bf0bcda8
- Child:
- 2:cc9d8ec2e1f4
File content as of revision 1:48b0bf0bcda8:
#include "engine.h"
void engine::init(){
}
void engine::fire(int x,int y, bullet &b){
b.x = x;
b.y = y;
}
events engine::evet_check(plane &p, bomb &b, Gamepad &pad, bullet &bu){
xy pxy = p.getxy();
int width = p.getwidth();
int height = p.getheight();
if(b.x>-1){
if(((pxy.x - b.width < b.x)&&(pxy.x+width>b.x)) &&((pxy.y-b.height<b.y)&&(pxy.y+height>b.y))){
return DEAD;
}
}
if(pad.get_direction() == N){
return FIRE;
}
if(bu.x>-1&&b.x>-1){
if(((bu.x - b.width < b.x)&&(bu.x+2>b.x)) &&((bu.y-b.height<b.y)&&(bu.y+2>b.y))){
return ELMININATE;
}
}
return NONE;
}
int engine::randombomb(){
int a = 5;
int b = 35;
int y = (rand() % (b-a+1))+ a;
return y;
}