Actor Dying
markh72
Member Posts: 23
Hello again
I've now managed to position my actors, when a crosshair is over the actor
it knows it's over and i can shoot where the actor is, (no bullets are fired)
how can i now get the actor to die, knowing that the crosshair is over it and the fire button
pressed?? ive tried collide, but this just sends the actor bouncing around the page the
moment its touched, whether ive fired or not ?!!?
I cant seem to find anyway of saying in an actors rules, that if the crosshair is over them and the trigger pressed then change image to actor_dead ??
can this be done ?
I've now managed to position my actors, when a crosshair is over the actor
it knows it's over and i can shoot where the actor is, (no bullets are fired)
how can i now get the actor to die, knowing that the crosshair is over it and the fire button
pressed?? ive tried collide, but this just sends the actor bouncing around the page the
moment its touched, whether ive fired or not ?!!?
I cant seem to find anyway of saying in an actors rules, that if the crosshair is over them and the trigger pressed then change image to actor_dead ??
can this be done ?
Comments
If it's collided with the crosshair AND the fire button is pressed
change image to actor_dead
the actor. this is where im struggling
When that is the case, change image.
in my inspector / scene screen i have a list:
> background
spawner
crosshair
soldier1
soldier2
soldier3
scene1
although in crosshair i can make it say if crosshair is at these co-ordinates, and it's overlaying/colliding with soldier one, then allow to shoot, but then if i do a change image to soldier1_dead, it will only change the crosshair image, not the soldiers. and in the soldiers attributes, it cant see the crosshair in the attribute browser?!? i can cross-reference to know things are happening, can someone give me examples, or show me code in their game that works ??
thanks again
doooh !
However, you don't need to.
I imagine you have a rule somewhere that checks for a button press or some type of touch/mouse action to trigger the actual firing, no?
If that is the case do the following:
You need a game attrib (boolean), I'll call it `shooting`, that gets set to true when the player is firing/shooting...be sure to set it back to false when not firing...
Then, in the solider actor you want a rule checking for collision with the cross hair and `game.shooting` to be true.
`
IF Solider1 "Overlaps or Collides" with crosshair AND game.shooting is true
-THEN change image to soldier1_dead
`
thanks in advance