X-Git-Url: https://git.mxchange.org/?p=quix0rs-blobwars.git;a=blobdiff_plain;f=src%2Fbullets.cpp;h=b8a416fa1d3ee6f894201416ffff2dd38d8a8b2e;hp=fb846423619f294222b60db9f06f273947c22413;hb=acf6c1044be2667ee799327e350f0d890bd55fb8;hpb=128d4058a4e0d37b7bef394ccde7277391e4ae0e diff --git a/src/bullets.cpp b/src/bullets.cpp index fb84642..b8a416f 100644 --- a/src/bullets.cpp +++ b/src/bullets.cpp @@ -49,6 +49,16 @@ void addBullet(Entity *owner, float dx, float dy) 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;