Yuheng Huo / Mbed 2 deprecated hyh_copy

Dependencies:   mbed FXOS8700CQ

Committer:
Neowless
Date:
Fri May 15 12:32:47 2020 +0000
Revision:
1:48b0bf0bcda8
Child:
2:cc9d8ec2e1f4
test;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Neowless 1:48b0bf0bcda8 1 #include "engine.h"
Neowless 1:48b0bf0bcda8 2
Neowless 1:48b0bf0bcda8 3
Neowless 1:48b0bf0bcda8 4 void engine::init(){
Neowless 1:48b0bf0bcda8 5 }
Neowless 1:48b0bf0bcda8 6
Neowless 1:48b0bf0bcda8 7 void engine::fire(int x,int y, bullet &b){
Neowless 1:48b0bf0bcda8 8 b.x = x;
Neowless 1:48b0bf0bcda8 9 b.y = y;
Neowless 1:48b0bf0bcda8 10 }
Neowless 1:48b0bf0bcda8 11 events engine::evet_check(plane &p, bomb &b, Gamepad &pad, bullet &bu){
Neowless 1:48b0bf0bcda8 12 xy pxy = p.getxy();
Neowless 1:48b0bf0bcda8 13 int width = p.getwidth();
Neowless 1:48b0bf0bcda8 14 int height = p.getheight();
Neowless 1:48b0bf0bcda8 15 if(b.x>-1){
Neowless 1:48b0bf0bcda8 16 if(((pxy.x - b.width < b.x)&&(pxy.x+width>b.x)) &&((pxy.y-b.height<b.y)&&(pxy.y+height>b.y))){
Neowless 1:48b0bf0bcda8 17 return DEAD;
Neowless 1:48b0bf0bcda8 18 }
Neowless 1:48b0bf0bcda8 19 }
Neowless 1:48b0bf0bcda8 20 if(pad.get_direction() == N){
Neowless 1:48b0bf0bcda8 21 return FIRE;
Neowless 1:48b0bf0bcda8 22 }
Neowless 1:48b0bf0bcda8 23 if(bu.x>-1&&b.x>-1){
Neowless 1:48b0bf0bcda8 24 if(((bu.x - b.width < b.x)&&(bu.x+2>b.x)) &&((bu.y-b.height<b.y)&&(bu.y+2>b.y))){
Neowless 1:48b0bf0bcda8 25 return ELMININATE;
Neowless 1:48b0bf0bcda8 26 }
Neowless 1:48b0bf0bcda8 27 }
Neowless 1:48b0bf0bcda8 28 return NONE;
Neowless 1:48b0bf0bcda8 29 }
Neowless 1:48b0bf0bcda8 30
Neowless 1:48b0bf0bcda8 31
Neowless 1:48b0bf0bcda8 32 int engine::randombomb(){
Neowless 1:48b0bf0bcda8 33 int a = 5;
Neowless 1:48b0bf0bcda8 34 int b = 35;
Neowless 1:48b0bf0bcda8 35 int y = (rand() % (b-a+1))+ a;
Neowless 1:48b0bf0bcda8 36 return y;
Neowless 1:48b0bf0bcda8 37 }
Neowless 1:48b0bf0bcda8 38
Neowless 1:48b0bf0bcda8 39