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.
Diff: Engine/engine.cpp
- Revision:
- 1:48b0bf0bcda8
- Child:
- 2:cc9d8ec2e1f4
diff -r 03d005063b30 -r 48b0bf0bcda8 Engine/engine.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Engine/engine.cpp Fri May 15 12:32:47 2020 +0000
@@ -0,0 +1,39 @@
+#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;
+}
+
+