GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

how to make a rule for second actors under first actor ?

akaomid1akaomid1 Posts: 26Member, PRO

I have two players. that start at the same time as the game starts. I want to make a rule under the first player saying if first player dies kill second player too. and under the second player I want to say if second player dies kill player one too. how do I go about this ? they are both actors and I don't know how to code that. so the way it goes I have :

under player one
when actor recives event overlaps or collides with actor type wall. kill player. go to game over scene.

under player two
when actor recives event overlaps or collides with actor type wall. kill player. go to game over scene.

but once one dies when i come back to the same scene the other one is alive still I want both players to be gan when only one hits the wall.

Comments

  • AlchimiaStudiosAlchimiaStudios Posts: 1,022Member, PRO

    Do detection on the wall and create a variable to let the players actors know it's over.

    So when either player 1 or player 2 hits the wall, change attribute game.wallhit to true, on each of the player say when game.wallhit is true "kill player", after .1 change scene or something similar.

    Follow us: Twitter - Website

  • akaomid1akaomid1 Posts: 26Member, PRO

    yes but if i restart game again right away one player is alive. My games are with in one scene. it has deferent stages 0 = home 1= gameplay 2 = gameover. so when it loads 1 after I went to 2 shows player still alive my other player.

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    Hi @akaomid1 try replacing the boolean attribute if its a scene attribute with a game attribute.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • akaomid1akaomid1 Posts: 26Member, PRO

    its an integer. its set to -1 as my load screen is set to -1. then after it loads 0 witch is my home and than 1 which is gameplate and I have named it stage. so stage is = -1 at start and its an integer.

  • akaomid1akaomid1 Posts: 26Member, PRO

    can you give me some idea what on your mind ?

  • AlchimiaStudiosAlchimiaStudios Posts: 1,022Member, PRO

    @akaomid1 said:
    yes but if i restart game again right away one player is alive. My games are with in one scene. it has deferent stages 0 = home 1= gameplay 2 = gameover. so when it loads 1 after I went to 2 shows player still alive my other player.

    Not sure I understand fully... if you tie them to the same attribute and put collision detection on the wall actor, that then changes the attribute; regardless of who hits the wall it will trigger for both of them.

    If you have this and it's not triggering right, you order of operations or logic might be flawed.

    OR since you make mention of a gameover screen when a variable is 2, why not say when variable is 2 " kill all actors", so when you go back to 1 they have died fore sure.

    Follow us: Twitter - Website

  • akaomid1akaomid1 Posts: 26Member, PRO

    i need both of my players to be destroyed when one of them is hit . can you give me an example ?

  • AlchimiaStudiosAlchimiaStudios Posts: 1,022Member, PRO
    Wall actor:
    
    when actor recieves event overlaps or collides with player 1
    or
    when actor recieves event overlaps or collides with player 2:
    
    Change attribute game.KillPlayer to true
    
    player 1 actor:
    
    When attribute game.killplayer is true:
    
    "Insert Kill Actor logic"
    
    
    player 2 actor:
    
    When attribute game.killplayer is true:
    
    
    "Insert Kill Actor logic"
    

    Follow us: Twitter - Website

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    You have 2 different convos here - so excuse me, @AlchimiaStudios :-)

    @akaomid1 said:
    its an integer. its set to -1 as my load screen is set to -1. then after it loads 0 witch is my home and than 1 which is gameplate and I have named it stage. so stage is = -1 at start and its an integer.

    No, I meant a boolean as a trigger for destroying the other actor. something like:

    Make a game boolean called DestGo (make sure it's a game attribute).

    In your first actor, Put:

    Rule: When DestGo is true
    Destroy
    
    Rule: When This1Actor overlaps or collides with wall
    Change Attribute DestGo to true
    Destroy
    

    In your second actor:

    Rule: When DestGo is true
    Destroy
    
    Rule: When This2Actor overlaps or collides with wall
    Change Attribute DestGo to true
    Destroy
    

    In an actor outside of the play screen, put:

    Rule: When DestGo is true
    Timer: After 0.1 seconds
    Change Scene Game Over
    

    hopefully that should sort it for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • akaomid1akaomid1 Posts: 26Member, PRO

    okay does it matter if killplayer is integer or not. the way I had it was

    when actor recieves event overlaps or collides with player 1
    or
    when actor recieves event overlaps or collides with player 2:

    Change attribute game.stage to 3
    whitch showed gameover part.

    also how do I insert the kill Actor logic ?
    I get everything except that part.

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    The way you have it, you haven't programmed for when you visit the scene again and it "remembers" your two actors were killed.

    But thinking out loud, nor have I properly.... but before I amend the programming, a bit more info about what your after please:

    You say that after game over, and you start again, you don't want your two actors to be there, is that right? I don't understand that -surely if the user is trying again, you'd want it as it was at the beginning of the first go, i.e with both actors there, in place...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • AlchimiaStudiosAlchimiaStudios Posts: 1,022Member, PRO

    @akaomid1 said:
    okay does it matter if killplayer is integer or not. the way I had it was

    when actor recieves event overlaps or collides with player 1
    or
    when actor recieves event overlaps or collides with player 2:

    Change attribute game.stage to 3
    whitch showed gameover part.

    also how do I insert the kill Actor logic ?
    I get everything except that part.

    Well that depends, do you want to destroy the actor, or keep it around but disable it?

    How does the first actor die right now?

    It should hopefully be as simple as using a rule on both players

    when game.stage = 3
    destroy actor.

    Follow us: Twitter - Website

  • akaomid1akaomid1 Posts: 26Member, PRO

    yes so when it goes to stage 3 its kinda like gameover where you see score and want to try again. score is set to zero everything is a go the only think is when i want to make it challenge with two players everything works but when game stage changes because one of the players has hit the wall when i press try again it goes back to stage 2 and one player is still alive. If that makes a little more sense ?

  • akaomid1akaomid1 Posts: 26Member, PRO

    sorry guys I'm trying to answer both I guess both of are asking the same ...

  • akaomid1akaomid1 Posts: 26Member, PRO

    thanks gyroscope thanks AlchimiaStudios. does that clear my question ?

  • akaomid1akaomid1 Posts: 26Member, PRO

    gyroscope thanks that worked now I just need to reload my players how do I that ?

  • akaomid1akaomid1 Posts: 26Member, PRO

    I did try to Spawn my Actors after they are dead but nothing happens .

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    OK, if you just need to reload your players every time you enter the scene fresh, make sure you make any of your attributes as scene attributes. That way they won't be "remembered" when you leave the scene, and so will load up the default attributes when you enter the scene again.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • akaomid1akaomid1 Posts: 26Member, PRO
    edited December 2014

    any way to bypass that gyroscope? they are in my game attributes.

  • akaomid1akaomid1 Posts: 26Member, PRO

    now can I use the Alpha color since I cant get it to be reload after its destroyed ?

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    Then put a blank actor outside of the play area of your scene, and in it put change attribute behaviours for any game attributes that would have changed - to change them back.

    Example: say you have an integer which on losing play changes to 1, and it's 0 at the start of the play scene, put in this blank actor:

    Change Attribute YourGameAtt to 0 --- or whatever
    Change Attribute --- etc
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • akaomid1akaomid1 Posts: 26Member, PRO

    sorry I don't understand can you give a little more dept to the example ?

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    If you're using any game attributes for your active play scene, they will be remembered even when you leave the scene (say to the Game Over scene).

    And this means that when you go to your play scene again, it will used the changed attribute(s) - i.e it won't have reset the scene.

    Another example: When game.BooleanAttributeYouUse is true
    Change Attributes R, G and B to 0

    This is just an example - so the boolean becomes true, your white actor turns black.

    Now you go to another scene - and then back again - the attribute game.BooleanAttributeYouUse will still be true, and so your actor will be black, not white as it should be.

    The best way to avoid this is to remake your attribute (in this case game.BooleanAttributeYouUse) to a scene attribute, then it'll automatically revert to its original setting when you go out of the scene, then back again.

    If you haven't many changeable attributes, it's probably easier to just remake them as scene attributes and then update your Rules - only take couple of minutes.

    If you don't want to do that, then reset them in a blank actor outside of the scene, as I previously described in the other post.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • akaomid1akaomid1 Posts: 26Member, PRO

    Im glad you have helped me so much thank you just I just don't understand it. if it was like the way you did it up there in coding like :
    Rule: When DestGo is true
    Destroy

    Rule: When This1Actor overlaps or collides with wall
    Change Attribute DestGo to true
    Destroy
    In your second actor:

    Rule: When DestGo is true
    Destroy

    Rule: When This2Actor overlaps or collides with wall
    Change Attribute DestGo to true
    Destroy
    In an actor outside of the play screen, put:

    Rule: When DestGo is true
    Timer: After 0.1 seconds
    Change Scene Game Over

  • akaomid1akaomid1 Posts: 26Member, PRO

    I think I got it I did you rest. thank you so much .

Sign In or Register to comment.