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.
Dependencies: mbed Gamepad N5110
engine.cpp
00001 #include "engine.h" 00002 00003 00004 void engine::init(){ 00005 } 00006 00007 void engine::fire(int x,int y, bullet &b){ 00008 b.x = x; 00009 b.y = y; 00010 } 00011 events engine::evet_check(plane &p, bomb &b, Gamepad &pad, bullet &bu){ 00012 xy pxy = p.getxy(); 00013 int width = p.getwidth(); 00014 int height = p.getheight(); 00015 if(b.x>-1){ 00016 if(((pxy.x - b.width < b.x)&&(pxy.x+width>b.x)) &&((pxy.y-b.height<b.y)&&(pxy.y+height>b.y))){ 00017 return DEAD; 00018 } 00019 } 00020 if(pad.check_event(Gamepad::B_PRESSED) == true){ 00021 return FIRE; 00022 } 00023 if(bu.x>-1&&b.x>-1){ 00024 if(((bu.x - b.width < b.x)&&(bu.x+2>b.x)) &&((bu.y-b.height<b.y)&&(bu.y+2>b.y))){ 00025 return ELMININATE; 00026 } 00027 } 00028 return NONE; 00029 } 00030 00031 00032 int engine::randombomb(){ 00033 int a = 5; 00034 int b = 35; 00035 int y = (rand() % (b-a+1))+ a; 00036 return y; 00037 }
Generated on Sun Aug 7 2022 13:50:18 by
1.7.2