Help w/ Timer/Scene Change

I'll try to describe what I have as best I can. I set up a scene that looks like a room with objects in it. I put a new game attribute in as an integer to act as a timer (10 seconds). With the scene I enabled the timer with the background image and set it to spawn actor at the end of the timer (everything it set to run to completion). I wanted to make it so if I clicked on a specific object in the room it would change to the next scene (like a key to a level) but whenever I set the rule to change scene on an actor other than the background, it just changes scenes anyway. I can click anywhere in the room and it'll change, instead of it being directly linked to the object. I have no idea what is going on with it or how to fix it.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2016

    @kristi.forbes0000 said:
    I have no idea what is going on with it or how to fix it.

    If you have no idea what's going on - and you have full access to the rules ! Imagine trying to solve this issue without being able to see any of the rules :)

    A screenshot of the offending actor's code would really help work out the issue.

  • kristi.forbes0000kristi.forbes0000 Member Posts: 4

    I honestly don't know how to add a picture to this forum so I'll write it

    The Background Rules:
    1)
    Attribute: game.gametimer is > 0
    Timer: Every 1 second (run to completion)
    Change Attribute: game.gametimer to game.gametimer -1

    2)
    Attribute: game.gametimer = 0
    Spawn actor: died, in front of layer

    That's the only rules on the background.

    Actors Rules

    1)
    Actor Receives Event: mouse button is down
    Change scene: go to bedroom (scene)

    Everything is set to run to completion so I don't know where the overlapping problem is.

  • kristi.forbes0000kristi.forbes0000 Member Posts: 4

    @Socks said:

    @kristi.forbes0000 said:
    I have no idea what is going on with it or how to fix it.

    If you have no idea what's going on - and you have full access to the rules ! Imagine trying to solve this issue without being able to see any of the rules :)

    A screenshot of the offending actor's code would really help work out the issue.

    I honestly don't know how to add a picture to this forum so I'll write it

    The Background Rules:
    1)
    Attribute: game.gametimer is > 0
    Timer: Every 1 second (run to completion)
    Change Attribute: game.gametimer to game.gametimer -1

    2)
    Attribute: game.gametimer = 0
    Spawn actor: died, in front of layer

    That's the only rules on the background.

    Actors Rules

    1)
    Actor Receives Event: mouse button is down
    Change scene: go to bedroom (scene)

    Everything is set to run to completion so I don't know where the overlapping problem is.

  • SocksSocks London, UK.Member Posts: 12,822

    @kristi.forbes0000 said:>

    . . . . . .

    Background:

    1)
    Attribute: game.gametimer is > 0
    Timer: Every 1 second (run to completion)
    Change Attribute: game.gametimer to game.gametimer -1

    2)
    Attribute: game.gametimer = 0
    Spawn actor: died, in front of layer

    . . . . . .

    What is the starting value for 'game.gametimer' ?

    If 'game.gametimer' starts with a value of 0 then:
    rule 1) won't fire
    rule 2) will spawn a single actor (and no more)

    If 'game.gametimer' starts with a value of less than 0 then:
    rule 1) won't fire
    rule 2) won't fire

    If 'game.gametimer' starts with a value of more than 0 then:
    rule 1) will - after 1 second - change the value to 0
    rule 2) will spawn a single actor (and no more)

    . . . . so, from what I can see there's no need for this timer at all, as all it does is spawn a single actor, if that's the case then you could simply replace both rules with a single Spawn behaviour ?

    Actors Rules

    1)
    Actor Receives Event: mouse button is down
    Change scene: go to bedroom (scene)

    This rule doesn't appear to be doing anything from what I can see ? What is the starting value for game.gametimer ?

    @kristi.forbes0000 said:>
    Actors Rules

    1)
    Actor Receives Event: mouse button is down
    Change scene: go to bedroom (scene)

    Mouse down means if you click your mouse button (or touch the screen on a mobile device) then perform an action . . . it doesn't specify that the mouse/touch needs to be on the actor.

    If you want to trigger an action when touching an actor use 'when touch is pressed' rather than 'when mouse button is down'.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Watch the video as you need to understand how things work. Have you done any of the tutorials on the gamesalad academy? This is the best way to start to learn.

  • kristi.forbes0000kristi.forbes0000 Member Posts: 4

    The pressed action worked! Thank you for that! For the spawn actor though, how would it work without the timer? The purpose of the scene is to give 10 seconds to find the key and they can advance to the next level (the game timer is set at ten in game attributes). And with the other key actor set to pressed, the timer still keeps going and continues to spawn the actor even after I've gone to the next scene. What would be the best way to set a timer that only finishes if the time isn't cleared?

    Sorry if I'm not giving great description, I'm super new at this program and I'm trying to use it for a class.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited April 2016

    You need to uncheck run to completion on your timer and you also need to add a condition for when they find the key to that rule so it stops the timer as well

    Rule
    All

    When game timer is > 0 and when key.found is false.

    Your timer with run to completion unchecked. (This way the rule will cut off the timer when either the key is found or the timer runs out.)

    You only need one change scene rule and it should look like this.

    Rule
    Any

    When game timer =O or key.found is true

    Timer
    After .3

    Change scene

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2016

    @kristi.forbes0000 said:
    The purpose of the scene is to give 10 seconds to find the key and they can advance to the next level (the game timer is set at ten in game attributes).

    If you are simply counting down 10 seconds you can dump all the rules and attributes and simply have a timer that says:

    Timer: After 10 seconds:
    --Do action

    @kristi.forbes0000 said:
    And with the other key actor set to pressed, the timer still keeps going and continues to spawn the actor even after I've gone to the next scene.

    Sorry, I don't know what that means.

    @kristi.forbes0000 said:
    What would be the best way to set a timer that only finishes if the time isn't cleared?

    Don't know what 'time isn't cleared' means.

Sign In or Register to comment.