(RGSS3) Area of effect damage in Sapphire Action System

RedFawkes

Veteran
Veteran
Joined
Jun 21, 2018
Messages
39
Reaction score
16
First Language
BR Portuguese
Primarily Uses
RMVXA
My project is heavily based on SAS - Sapphire Action System. Recently, I've been looking for ways of implementing some sort of AoE attack. Take this video example, for instance:


What I wanted to do is make so that this attack hits in an 180 degree arc - so it hits in all directions except your back. Here's the code I use (it can be found at around line ~1450:

Ruby:
if $game_switches[193]
     tx = @px + Sapphire_Core::Weapon_Range[@direction][0]
     ty = @py + Sapphire_Core::Weapon_Range[@direction][1]
     tx1 = @px + Sapphire_Core::Weapon_Range[@direction][0] * 2
     ty1 = @py + Sapphire_Core::Weapon_Range[@direction][1] * 2
     tx2 = @px + Sapphire_Core::Weapon_Range[@direction][0] * 3
     ty2 = @py + Sapphire_Core::Weapon_Range[@direction][1] * 3
   else
     tx = @px + Sapphire_Core::Weapon_Range[@direction][0]
     ty = @py + Sapphire_Core::Weapon_Range[@direction][1]
     tx1 = @px + Sapphire_Core::Weapon_Range[@direction][0]
     ty1 = @py + Sapphire_Core::Weapon_Range[@direction][1]
     tx2 = @px + Sapphire_Core::Weapon_Range[@direction][0]
     ty2 = @py + Sapphire_Core::Weapon_Range[@direction][1]
end
       for char in $game_map.enemies
        if char.pixel_range?(tx,ty) or char.pixel_range?(tx1,ty1) or char.pixel_range?(tx2,ty2)
What this does is that whenever the player is executing a charged attack (switch 193 is ON) the new "collision" will kick in during the damage process, applying the "tx1", "ty2" etc locations to the array of positions that will receive the attack, checking for enemies in multiple positions. I admit that I simply don't quite understand what most of this means, I simply copied the "tx" and "ty" lines and added a number to the variable name, then multiplied the value: the result is shown in the video.

I'd like to receive some guidance regarding where I should start looking for solutions and what most of this code actually means.

If you're a coder and feel interested in the project, I'm looking for scripters to hop in and help us. Currently we're a team of two, with the other member working as the artist and me dealing with the technical aspect of the work. Of course, design debates are common between us and a third opinion would be welcome.

Thanks in advance!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top