Andreas Garmannslund / Mbed 2 deprecated SimplePlatformGame

Dependencies:   N5110 PinDetect PowerControl mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Enemy.cpp Source File

Enemy.cpp

Go to the documentation of this file.
00001 #include "Enemy.h"
00002 
00003 /// @file Enemy.cpp
00004 
00005 /// Setup the enemy based on type
00006 void Enemy::setup()
00007 {   
00008     switch (type)
00009     {
00010         case SIMPLE:
00011             width = 5;
00012             height = 5;
00013             vx = 1;
00014             difficulty = 1;
00015             jumpRate = 3;
00016         break;
00017         
00018         case JUMPER:
00019             width = 3;
00020             height = 4;
00021             vx = 1;
00022             difficulty = 3;
00023             jumpRate = 50;
00024         break;
00025         
00026         case RUNNER:
00027             width = 6;
00028             height = 5;
00029             vx = 2;
00030             difficulty = 5;
00031             jumpRate = 0;
00032         break;
00033         
00034         default: // error, should not be possible
00035             width = height = vx = vy = 0;
00036     }
00037     
00038     if (facingLeft)
00039         vx *= -1;    
00040 }