Ok.
Things are going well.... Ish.
I had set up two objects { a player and an enemy }
and given each their own set of variables to track statistics like { hit points, attack power, defence, accuracy and so on }
Then I wanted to see what would happen if I had two instances of the enemy in play.
It appears that each instance track their own set of variables - which is perfect: exactly what I needed and why I started this topic.
However, two issues arose from my short test.
1. When the enemy fires a bullet, every one of the bullets always set their direction to the same image_angle as the enemy instance with the lowest id.
This is because of the code I use in the bullets, which I will show later.
2. I have another object which is used to draw the enemy HP just above them, but it only does it for the enemy instance with the lowest id.
This is also because of code used in this particular object.
So the problem must arise from how I am choosing to access these variables.
The method I am currently using is as thus:
obj_bullet Create Event:
image_angle = obj_enemy.image_angle;
direction = image_angle;
obj_drawEnemyHealth Draw Event:
if (instance_exists(obj_enemy))
{
draw_text(obj_enemy.x,obj_enemy.y-16,string(obj_enemy.NRG));
}
(btw, NRG is used for hit points. Say it slowly... En... Ar... Gee... Energy!)
Both problems arise from the same method of data access, but I have a feeling that they will require two separate solutions.
So what do you guys make of this?
If this was your project, what would you do?
Edited by _174413, 20 April 2012 - 09:17 PM.