Actor Dying

markh72markh72 Member Posts: 23
edited November -1 in Working with GS (Mac)
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 ?

Comments

  • VmlwebVmlweb Member Posts: 427
    You need to go in the actor and say

    If it's collided with the crosshair AND the fire button is pressed
    change image to actor_dead
  • markh72markh72 Member Posts: 23
    but there isnt a behavior that allows you to see the crosshair attribute only the details of
    the actor. this is where im struggling
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    You want the condition in you rule for the actor to be "Overlaps or Collides" with the crosshair actor type...

    When that is the case, change image.
  • VmlwebVmlweb Member Posts: 427
    markh72 said:
    but there isnt a behavior that allows you to see the crosshair attribute only the details of
    the actor. this is where im struggling

    Make a game attribute instead of local (Inside actors) then use that one
  • markh72markh72 Member Posts: 23
    yeah ive tried that, but i dont seem to beable to cross reference one actors attributes to another actor. when i use the attribute browser, it only brings up conditions for that actor, not for another actor, is there some other way of doing this that ive missed?

    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
  • markh72markh72 Member Posts: 23
    sorry that was meant to say, i cant cross-reference
    doooh !
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    You can "cross-reference" at the instance level, but not in the prototype.

    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
    `
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    ^Edited above^
  • markh72markh72 Member Posts: 23
    hmmm ill try that and let you no

    thanks in advance
  • markh72markh72 Member Posts: 23
    sussed it out out, thanks for the help barkbark00
  • BaDDAppleBaDDApple Member Posts: 49
    I have a similar problem. I have it working when the cross hairs goes over an actor and I click it fires correctly, the actor disappears and the gun sounds play and a point total floats above them. Great. I wanted to go an extra step and if the player missed they would get a ricochet sound and negative points float up. Add similar code for miss if it overlaps with the background. It works great, but if I now I get both the gun sound, ricochet sound and both negative and positive points floating up. I know I'm missing a small step somewhere. Any help would be appreciated. Thanks!
Sign In or Register to comment.