0 "Pistol" 0 1 60 10 0 15 FlameBulletRight FlameBulletLeft 3 ENT_WEIGHTLESS
1 "Machine Gun" 1 1 60 10 0 4 FlameBulletRight FlameBulletLeft 6 ENT_WEIGHTLESS
2 "Laser Cannon" 2 1 120 13 0 40 LaserBolt LaserBolt 19 ENT_WEIGHTLESS+ENT_BOUNCES
-3 "Grenades" 3 50 240 3 -2 20 Grenade Grenade 31 ENT_BOUNCES+ENT_EXPLODES
+3 "Grenades" 3 50 240 1 -2 20 Grenade Grenade 31 ENT_BOUNCES+ENT_EXPLODES
4 "Spread Gun" 4 1 240 15 0 15 PlasmaBolt PlasmaBolt 34 ENT_WEIGHTLESS+ENT_PARTICLETRAIL
5 "Rocket Launcher" 5 75 240 8 8 45 FlameBulletRight FlameBulletLeft 11 ENT_WEIGHTLESS+ENT_FIRETRAIL+ENT_EXPLODES
bullet->id = owner->currentWeapon->id;
bullet->dx = dx;
bullet->dy = owner->currentWeapon->dy + dy;
+
+ // Add motion of the player and any platform he/she is on to grenades
+ if (owner->currentWeapon->dy)
+ {
+ int tdx, tdy;
+ getTrainMotion(owner, tdx, tdy);
+ bullet->dx += owner->dx - tdx;
+ bullet->dy += -tdy;
+ }
+
bullet->next = NULL;
bullet->health = owner->currentWeapon->health;
bullet->damage = owner->currentWeapon->damage;
#include "headers.h"
extern bool checkTrainContact(Entity *ent, int dir);
+extern void getTrainMotion(Entity *ent, int &dx, int &dy);
extern bool checkObstacleContact(Entity *ent, int dir);
extern void enemyBulletCollisions(Entity *bullet);
extern void checkPlayerBulletCollisions(Entity *bullet);
}
}
+void getTrainMotion(Entity *ent, int &dx, int &dy)
+{
+ dx = 0;
+ dy = 0;
+ Train *train = (Train*)map.trainList.getHead();
+ while (train->next != NULL) {
+ train = (Train*)train->next;
+ bool collision = (Collision::collision(ent->x, ent->y + ent->dy, ent->width, ent->height - 1, train->x, train->y, train->width, train->height));
+ if(collision) {
+ dx = train->getDX();
+ dy = train->getDY();
+ break;
+ }
+ }
+}
+
/**
* Checks to see if an entity has touched this train. Depending on
* the trains status certain other functions will be invoked