Pie115 / CS179RTS

Space themed RTS Game
2 stars 0 forks source link

Sean/planet laser beam #24

Closed seanxpw closed 3 months ago

seanxpw commented 3 months ago

Please review it along with PR #23.

  1. created a new BP to handel laser effects Content/BluePrints/LaserBeam/BP_Laser.uasset
  2. add functions in Content/BluePrints/Planet_ParentBP.uasset image and blueprints to assign an enemy for the laser to chase for. image
  3. add a new function in Content/BluePrints/Utilities/BP_UtilityLibrary.uasset This function returns a sorted array of enemies based on the distance to gate image note that the sort function is implement in c++ for convience and performance. image
  4. Assign the gate Content/TA2Project/Non-PlayerEntities/TA2_Gate_Prototype.uasset to keep sorting the enemy array. image

Note that the laser beam won't cause damage to the enemy. It's only a visual effect. It's possible to break the assigning enemy logic if the game has more than ONE gate

seanxpw commented 3 months ago

btw to test this make sure to switch the map to Content/Maps/AttackTestMap.umap

seanxpw commented 3 months ago

@NateBeatty in BP_DummyEnemy, I created a custom event to receive damage. image So if u wish to deal damage to my dummy enemy, feel free use apply damage, below is how i deal damage to enemy by missile in BP_missile. image

Additionally, If you want to cause damage to the same enemy as my laser's target enemy. you'll need to use this variable in Content/BluePrints/Planet_ParentBP.uasset This variable keeps the nearest enemy to gate within attack range. image But You CANNOT expect this vatiable to always be valid, so make sure do validation check before applying damage. Function Set Target to Nearest Enemy To Gate WIthin Range updates this variable every 0.4 seconds.

btw this is the logic in BP_Laser to chase an given enemy every tick. you could try use the same logic to apply damage. image

If you want to cause damage to another enemy instead of the nearest enemy calculated as above, you might want to change my laser beam end. This event in BP_Laser is unused for now. image

seanxpw commented 3 months ago

big update in BP_planet see dc for details lol