mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-21 23:08:49 -05:00
Start bullet spread
This commit is contained in:
parent
5faa00ecb3
commit
817e6348b0
1
TODO.txt
1
TODO.txt
@ -20,6 +20,7 @@
|
||||
a build script that creates multiple binaries (with different combinations of
|
||||
compilers and settings)
|
||||
- run on raspbery pi
|
||||
- check if monsters are hit by bullets from completely up close
|
||||
|
||||
bugs:
|
||||
|
||||
|
@ -104,6 +104,11 @@
|
||||
*/
|
||||
#define SFG_HEALTH_KIT_VALUE 20
|
||||
|
||||
/**
|
||||
Angle in which multiple projectiles are spread, RCL_Units.
|
||||
*/
|
||||
#define SFG_PROJECTILE_SPREAD_ANGLE 100
|
||||
|
||||
#define SFG_MAX_MONSTERS 64
|
||||
|
||||
#define SFG_MAX_PROJECTILES 12
|
||||
@ -360,7 +365,7 @@ SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] =
|
||||
/* m. gun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,300),
|
||||
/* r. laun. */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_FIREBALL,900),
|
||||
/* plasma */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,350),
|
||||
/* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,350)
|
||||
/* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,750)
|
||||
};
|
||||
|
||||
#define SFG_PROJECTILE_EXPLOSION 0
|
||||
|
43
main.c
43
main.c
@ -1596,8 +1596,8 @@ void SFG_gameStep()
|
||||
projectile = SFG_PROJECTILE_FIREBALL;
|
||||
break;
|
||||
|
||||
case SFG_WEAPON_FIRE_TYPE_BULLET:
|
||||
case SFG_WEAPON_FIRE_TYPE_SPREAD_BULLETS:
|
||||
case SFG_WEAPON_FIRE_TYPE_BULLET:
|
||||
projectile = SFG_PROJECTILE_BULLET;
|
||||
break;
|
||||
|
||||
@ -1609,17 +1609,38 @@ void SFG_gameStep()
|
||||
projectile = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (projectile != SFG_PROJECTILE_NONE)
|
||||
SFG_launchProjectile(
|
||||
projectile,
|
||||
SFG_player.camera.position,
|
||||
SFG_player.camera.height,
|
||||
RCL_angleToDirection(SFG_player.camera.direction),
|
||||
(SFG_player.camera.shear * SFG_GET_PROJECTILE_SPEED_UPS(projectile)) /
|
||||
SFG_CAMERA_MAX_SHEAR_PIXELS,
|
||||
SFG_ELEMENT_COLLISION_DISTANCE + RCL_CAMERA_COLL_RADIUS
|
||||
);
|
||||
{
|
||||
uint8_t projectileCount = 1;
|
||||
|
||||
// TODO: move bullet count to weapon table
|
||||
if (SFG_player.weapon == SFG_WEAPON_SHOTGUN)
|
||||
projectileCount = 2;
|
||||
else if (SFG_player.weapon == SFG_WEAPON_SOLUTION)
|
||||
projectileCount = 4;
|
||||
|
||||
uint16_t angleAdd = SFG_PROJECTILE_SPREAD_ANGLE / (projectileCount + 1);
|
||||
|
||||
RCL_Unit direction =
|
||||
(SFG_player.camera.direction - SFG_PROJECTILE_SPREAD_ANGLE / 2)
|
||||
+ angleAdd;
|
||||
|
||||
for (uint8_t i = 0; i < projectileCount; ++i)
|
||||
{
|
||||
SFG_launchProjectile(
|
||||
projectile,
|
||||
SFG_player.camera.position,
|
||||
SFG_player.camera.height,
|
||||
RCL_angleToDirection(direction),
|
||||
(SFG_player.camera.shear * SFG_GET_PROJECTILE_SPEED_UPS(projectile)) /
|
||||
SFG_CAMERA_MAX_SHEAR_PIXELS,
|
||||
SFG_ELEMENT_COLLISION_DISTANCE + RCL_CAMERA_COLL_RADIUS
|
||||
);
|
||||
|
||||
direction += angleAdd;
|
||||
}
|
||||
}
|
||||
|
||||
SFG_player.weaponCooldownStartFrame = SFG_gameFrame;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user