[project1dev] Re: fireballs hurting enemies

  • From: Alan Wolfe <alan.wolfe@xxxxxxxxx>
  • To: project1dev@xxxxxxxxxxxxx
  • Date: Sun, 16 May 2010 12:04:21 -0700

Hey Kent,

I've been mulling over the stuff you said and here's what im thinking for
being able to do collision tests from script.  I think we can solve both
projectile impact as well as lightning bolt impact with the same solution.
let me know what you think...

#1 - make a script command Model_SetProperty where you can set properties to
a model such as Model_SetProperty(Model,"Enemy"); or
Model_SetProperty(Model,"PlayerProjectile");.  You can set multiple
properties on a model, you aren't just limited to one.

#2 - make a script command Model_HasProperty which tells you whether or not
a property is present on a model.  For instance if you wanted to know if a
model was an enemy, you could call... Model_HasProperty(Model,"Enemy"); and
it would return true or false depending on whether the model had that
property or not.

#3 - make commands to query regions of space to return all the models in
that region and let you loop through them one by one.

Putting that all together we could do something like this:

-- search a 2d rectangle (ie ignore height) for any models
ModelQuery_Rect2D(10,10,20,20);

NextModel = ModelQuery_GetNextResult();

-- for each model found
while NextModel != -1 do
  if Model_HasProperty(NextModel,"Enemy") then
    Debug_Print("there was an enemy in there!");
  end
  NextModel = ModelQuery_GetNextResult();
end

I think setting it up that way we could solve all the collision stuff:

Player fireballs:  Each frame for each fireball, do a 2d rect query to see
what's near the fireball.  When a fireball gets close enough to an enemy, it
homes at that enemy, does damage to it when it's close enough and then
disappears (solving the height issue we talked about)

Enemy rocks:  Each frame for each rock, do a query to see whats near the
rock.  If the player or a citizen is close enough to the rock, it homes at
the target, does damage when close enough and then disappears (also possibly
solving the problem of how enemies aim the rocks!)

Player lightning: When casting the lightning spell, do a query to see whats
within range of where the lightning bolt was cast.  All enemies found within
range take damage.

Sound ok to you?

On Sun, May 16, 2010 at 8:44 AM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:

> yeah this seems like the good solution, i added it to the wiki.
>
>
> On Sat, May 15, 2010 at 11:42 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:
>
>> Thats a good point.
>>
>> If we have bullets that hit the first enemy they encounter then stop
>> (which i think we should... and i think act raiser did), we could totally do
>> it that way where when it figures out which enemy it's hitting (ie it gets
>> real close disregarding height) , it literally homes in on it and hits it.
>>
>> that is a really cool solution and might not look un-natural (:
>>
>>
>> On Sat, May 15, 2010 at 11:37 PM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>
>>> oh another thought. You could simply have them slightly homing. Where
>>> they automatically curve in towards enemies but they will minimally effect
>>> the X and Y axis and effect the Z as much as it needs to. If you don't want
>>> to give this kind of power early on it could be an ability upgrade later.
>>>
>>> You could also have if the attack is withing so many units of the target
>>> then it will automatically home in. So it would not curve in early but if it
>>> is close to the target it would track on and hit. This way a close enough
>>> attack would always hit. This could also be some kind of an attack upgrade.
>>>
>>>
>>> On Sat, May 15, 2010 at 11:31 PM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>
>>>> If you wanted to take the magical approach you could make it like the
>>>> old 2d ones. Where if the flying projectile appears to hit the ground unit
>>>> it collides. You would need to adjust the ground enemies hit box to line up
>>>> with the projectile in the air.
>>>>
>>>>
>>>> On Sat, May 15, 2010 at 11:22 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx>wrote:
>>>>
>>>>> when i was thinking about making an updated version of act raiser (3d
>>>>> version) origionaly, the biggest hurdle in my head was "how could we have
>>>>> you shoot an arrow (or something like that) and have it hit any enemy
>>>>> whether it was on the ground or in the air?"
>>>>>
>>>>> my idea was that we just make it hit all enemies regardless of height
>>>>> but try to hide the fact that it doesnt make sense by doing some "art 
>>>>> magic"
>>>>>
>>>>> like make the art in such a way where it doesn't look weird.
>>>>>
>>>>> i know that is kinda like saying "make it magically work" but i bet
>>>>> theres a way to make it seem ok.
>>>>>
>>>>> having to shoot a fireball down at an angle means that its a different
>>>>> type of attack and that now youd have to aim it to hit the ground near the
>>>>> enemy instead of just shooting that direction and hitting him.
>>>>>
>>>>> we might have to go that route in the end but i think it would be nice
>>>>> if we could make it work where you just shoot left and anything that it 
>>>>> hits
>>>>> (disregarding height) gets damaged :P
>>>>>
>>>>>
>>>>> On Sat, May 15, 2010 at 11:15 PM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>>>>
>>>>>> Fireballs should be able to be able to be shot down at an angle. Maybe
>>>>>> there could be 2 different shoot buttons. 1 for shooting straight and
>>>>>> another for shooting forward.
>>>>>>
>>>>>> Another option could be holding a key like ctrl down to make shooting
>>>>>> go downward and releasing ctrl would return the aim to level height.
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Other related posts: