Rllulium
New Member
- Reaction score
- 10
I have been fiddling with projectiles for a while, but it seems that no matter what I do I cannot get around the usage of GroupEnumUnitsInRange(), a static method and a global struct variable. So I am merely wondering if anyone knows of a more flexible implementation of the collision check? Thanks in advance.
JASS:
library Collide uses Movement
globals
private collide co
endglobals
struct collide extends movement
real radius
boolean continue = true
stub method Impact takes unit u returns boolean
return false
endmethod
static method Collision takes nothing returns boolean
if HitCheck(GetFilterUnit(), co.which) then
set co.continue = co.Impact(GetFilterUnit())
endif
return false
endmethod
method Action takes nothing returns boolean
set co = this
call GroupEnumUnitsInRange(FilterGroup, GetUnitX(.which), GetUnitY(.which), .radius, Filter(function thistype.Collision))
set this = co
return .continue
endmethod
static method create takes unit which, real angle, real range, real speed, real acc, real radius returns collide
local thistype c = thistype.allocate(which, angle, range, speed, acc)
set c.radius = radius
return c
endmethod
endstruct