Hello,
i will talk about my Blendfile and the Problems i got first, before i ask my questions. Please be gentle, i am quite inexperienced with the BGE and with Python. If you want to know the Questions first, scroll down please.
I will add Blendfiles if needed.
Short Description:
I have a Testgame, two Spaceships, one controlled by the player, one is using a ray for shooting calculation and has a steering Actuator to chase the player if it comes near. I will call them enemy_ship and player_ship.
Properties in both objects:
HP - Hitpoints of the object
mass - tells Laser that they should end their life when colliding.
player/enemy - to distinguish roles. the Near Sensor of the enemy reacts on the Property player
Property in the enemy object only:
near - tells if the player is out of range (0) for following and shooting, near enough for slow follow and shooting (1) or very close for collision-melee-attack (2).
Testsetup:
Aims:
- a) The Properties mentioned should be displayed, i toggled the option in blender.
- b) The HP should be subtracted on collision with Laser-hits and player_ship & enemy_ship direct collision.
- c) The Objects should end after the HP are at 0.
- d) The Enemy Ship should chase after the player.
Scenarios:
1)
The Player_ship and Enemy_ship are at Layer 1.
What happens:
a) fine - everything is displayed right
b) good - HP are subtracted on both ships
c) yes - ships can both die
d) nice - the chase works!
The Player starts at Layer 1, the enemy_ship is spawned via empty (it is located on a different layer).
a) The Player “HP” are displayed right, “near” and enemy “HP” are not displayed right -> stay at 100 and 0.
b) Both ships can die. The Calculation works.
c) “”
d) The chase works.
The Player starts at Layer 2 and is spawned by an Empty, the Enemy is at Layer 1 from start without spawn.
a) Near and HP of Enemy are displayed right, (after endobj the value stays where it was). Player HP are displayed false.
b) Both ships can die, the Calculation seems right.
c) “”
d) The steering isnt working. The Enemy charges onto the Player, but it gets stuck and cant change direction.
- Both Ships are at a different Layer and spawn via Empty.
a)No Property is displayed correct!
b) Both Ships can die
c) “”
d) The Steering isnt working.
My conclusion…:
…was, that the Properties get an issue, when the Object spawns from a different Layer. I tried it with Delay and without. No change.
Or is it maybe an other Issue with the Steering Actuator?
I am not sure, because the HP are calculated correctly in all cases. I found someone who wrote “desgraph problem” and update does not function well. Sorry, i do not understand “very well” what that means or how i can solve that.
Thats confusing me too. Before testing it a second time, sometimes Player or Enemy were invincible (b was not fulfilled). Maybe i solved it ?
And another Issue i like to mention, in the progress of work blender used to crash every time, when the Enemy was “ended” and the Properties were displayed. Now, Blender does not care anymore.
My Questions and Requests:
- Please tell me about Bugs, it may help me
- I thought about solving the Problem with Python at first. If it really is a problem of blender and updates of properties.
But how can My Objects tell each other that they are “player” and “enemy”. I like to rebuild the functionality i used with logic bricks in python, but i dont know how. Messages seem like a good starting point, but i need to tell an object directly (but dont know whom i tell!) or i need to tell every Object via message, but how can the enemy find out that the Player is really near?
If you can give me some hints to get out of confusion it would be nice
Optional Bonus :
3) My Parented Camera on the Object does not work too when it is spawned, any idea to fix that?
4) Tell me whatever you think could help.
Thank you for your time and effort!
JMH