The thing is, all went well until I introduced the Player type. The Enemy type was dependent on just the "anim = LoadAnimMesh("myanimmesh")" and now that there's more then one player, it's not sure what to do.
For example, I had it
cam = CreateCamera()
anim = LoadAnimMesh
That was all I needed to put into the enemy functions
And since I changed the player to Types i've used this
p\cam = CreateCamera()
p\mdl = LoadAnimMesh
I do want a camera per player so if I ever add multiplayer it will be there.
Anyways, here is where it gives me the "Object does not exist" error after the entity is freed and deleted
It highlights the "If All\status = 0 Then" part and shows me the error. Which doesn't explain too much to me.
My conclusion is, they die just fine when they're hit by the newest type created. But if there's two player types spawned, the old/first one will give you an error if it touches it.
For example, I had it
cam = CreateCamera()
anim = LoadAnimMesh
Function Enemy_controls(All.Enemy) If EntityInView(All\mdl,cam) = 1 Then If EntityInView(All\mdl,cam) = 1 If EntityX(anim,True) < EntityX(All\mdl,True)... ...
That was all I needed to put into the enemy functions
And since I changed the player to Types i've used this
p\cam = CreateCamera()
p\mdl = LoadAnimMesh
Function Enemy_controls(All.Enemy,p.Player) ;For All.Enemy = Each Enemy ;For p.Player = Each Player If EntityInView(All\mdl,p\cam) = 1 Then If EntityInView(All\mdl,p\cam) = 1 If EntityX(p\mdl,True) < EntityX(All\mdl,True)... ...
I do want a camera per player so if I ever add multiplayer it will be there.
Anyways, here is where it gives me the "Object does not exist" error after the entity is freed and deleted
Function Enemy_check_status(All.Enemy,p.Player) If All\status = 0 Then Enemy_check_below(All) Enemy_controls(All,p) Enemy_player_inertia(All) ElseIf All\status = 1 Then Enemy_controls(All,p) Enemy_player_inertia(All) Enemy_jump_up(All) Enemy_check_above(All) ElseIf All\status = 2 Then Enemy_controls(All,p) Enemy_player_inertia(All) Enemy_fall(All) Enemy_check_below(All) End If End Function
It highlights the "If All\status = 0 Then" part and shows me the error. Which doesn't explain too much to me.
My conclusion is, they die just fine when they're hit by the newest type created. But if there's two player types spawned, the old/first one will give you an error if it touches it.