b-wb
Member
Hey all,
First time posting on here, I frequently find what I need by searching other people's questions, but haven't found anyone else trying to do this just yet.
I'm working on a top down space flight game with controls similar to Atari's Asteroids but modular space ships made up of multiple objects. Ships spawn with a number of attached "addons" including weapons and thrusters, and these addons respond to the ships' controls.
As I build AI for computer pilots, I want them to have a rough idea of how far their weapons ranges are. Ideally, they would be able to tell what the ranges of all weapons were and fire each separately, but I'm not at that point yet. Currently, I'd be happy to find the longest range weapon and save that weapon's range as a single variable, say weapon_range
All ships fall under one parent object, par_starship, and all addons fall under one parent object, par_addon. There are parents under that category as well, such as, in this case, par_projectile_weapon. Each projectile_weapon object is defined with an object type as its projectile-- one type of blaster bolt may act differently from another. So to clarify:
-A starship creates projectile weapons
-The projectile weapons create projectiles
-The projectiles, in their variable definitions section, have defined speeds and lifetimes, which can be multiplied to find their ranges
My problem is this: is there a way that I can, immediately after spawning any given projectile weapon, send the maximum range back to the starship? What I want to do is search the value stored in the object type for the projectile and report that, regardless of the fact that no such projectiles exist during the first frame of the game.
Of course, I know there are other solutions, but I am hoping to avoid significant re-factoring unless there's a good reason for it. If there is a way to access the variable definition of an object, not a particular instance, then that's what I'm looking for!
Thank you in advance for considering my issue Many of you have already been a great help to me just by answering questions that I share with other, previous posters.
Wishing you well!
First time posting on here, I frequently find what I need by searching other people's questions, but haven't found anyone else trying to do this just yet.
I'm working on a top down space flight game with controls similar to Atari's Asteroids but modular space ships made up of multiple objects. Ships spawn with a number of attached "addons" including weapons and thrusters, and these addons respond to the ships' controls.
As I build AI for computer pilots, I want them to have a rough idea of how far their weapons ranges are. Ideally, they would be able to tell what the ranges of all weapons were and fire each separately, but I'm not at that point yet. Currently, I'd be happy to find the longest range weapon and save that weapon's range as a single variable, say weapon_range
All ships fall under one parent object, par_starship, and all addons fall under one parent object, par_addon. There are parents under that category as well, such as, in this case, par_projectile_weapon. Each projectile_weapon object is defined with an object type as its projectile-- one type of blaster bolt may act differently from another. So to clarify:
-A starship creates projectile weapons
-The projectile weapons create projectiles
-The projectiles, in their variable definitions section, have defined speeds and lifetimes, which can be multiplied to find their ranges
My problem is this: is there a way that I can, immediately after spawning any given projectile weapon, send the maximum range back to the starship? What I want to do is search the value stored in the object type for the projectile and report that, regardless of the fact that no such projectiles exist during the first frame of the game.
Of course, I know there are other solutions, but I am hoping to avoid significant re-factoring unless there's a good reason for it. If there is a way to access the variable definition of an object, not a particular instance, then that's what I'm looking for!
Thank you in advance for considering my issue Many of you have already been a great help to me just by answering questions that I share with other, previous posters.
Wishing you well!