Make scrolling background stop suddenly?

WolfieEnsaladaWolfieEnsalada Member Posts: 26
edited November -1 in Working with GS (Mac)
Hey all, just have a quick question about how to do something in GS. (Don't we all? xD)

So, I have a scrolling background thanks to the help of Hachiko and several other helpful people on here, but now I have a bit of a dilemma. When my character crashes into an obstacle, I want there to be an on-screen message that allows you to tap the screen to retry. However, the only problem is that the background keeps scrolling, so you don't have time to react to the message and it floats away. xD Does anyone know how to make it so that the background halts suddenly when it's game over? Thanks! ^__^

Comments

  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    Anyone? o_o"
  • jstrahanjstrahan Member Posts: 498
    Need to know how u got the background moving so we can tell u how to make it stop
  • reddotincreddotinc Member Posts: 653
    Just have the move behaviour set to move only when game.STOPBACKGROUND = 0

    then when you set game.STOPBACKGROUND to 1, the background will stop until it becomes 0 again :)

    // Red Dot Inc
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Wish I'd thought of that.... lol.
  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    Hmm... this isn't working. o__o" I have the Move behavior on the background, and I dragged a Rule in with an Attribute that says what you wrote, reddotinc, and set the Game Over Rule so that it has an attribute which says "game.STOPBACKGROUND = 1", but it still won't stop scrolling. Is it not supposed to be typed like that, or.. is it not an attribute? XD This is driving me crazy!
  • quantumsheepquantumsheep Member Posts: 8,188
    You don't type it - you select it in the expression editor (the little button next to the empty space).

    Hope that helps,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    That isn't working either. :(

    I have the movement thing set up so that it's a behavior on the background actor, just the Move behavior, and the background is scrollable. So it moves. I tried to set the attribute that way, and it didn't work, because the rule for the game to end and the retry link to come up is related to different actors, the obstacles and Blaze. So I can't make the background do anything using them. D= I'm probably not making any sense, though. -__-"
  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    YAY! It worked! :D QuantumSheep and reddotinc were right, I just had to add a new attribute to the Game, and then set it to true on my main actor. ^_^ Thanks everyone! Now to stop the foreground from moving... xD
  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    Okay, now this is weird. xD So... I have this thing where if the main actor crashes into an obstacle, it triggers text to display on the screen that says "Click to retry" or something like that, and now the problem is that it keeps scrolling by, and the background doesn't scroll. xD I want it to be that the text in the foreground doesn't scroll, and neither does the background. So I have it so that the background stops... but how do I get the stuff in the foreground to stop too? o__O"
  • quantumsheepquantumsheep Member Posts: 8,188
    Make a global attribute called 'retry' - make it a boolean.

    On your player, when they crash into an obstacle, put in the the behaviour:

    Change attribute: Retry to 'true'

    Ok - now you need to add a separate layer and make sure 'scrollable' isn't ticked.

    In this layer, make a new actor called 'control'.

    In this actor, have a rule that says:

    If attribute 'retry' is true, then

    spawn actor 'text that says retry'.

    make sure collision is off in the this actor's physics.

    On the text actor, have a rule that resets when touched any attributes you're using (such as 'retry', level, score, time, whatever) and is destroyed on touch.

    That should do it I reckon.

    Good luck with it,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    Thanks quantumsheep! :D Okay, just one issue with it:

    Everything works fine, the only problem is, when the text for retry appears on the screen, when you click on it, nothing happens. And it has a rule on it that says that when touch is pressed, the actor should be destroyed and the game should be reset. o_o" So I have no idea why it isn't working. Am I supposed to add the actor to one of the layers? I didn't add it into the game per se, it just appears on-screen when the spawn thing kicks in on the control actor.
  • quantumsheepquantumsheep Member Posts: 8,188
    Can you post a pic of the actor please?

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    Okay, here it is ^_^"

    http://tinyurl.com/24a2ezo

    I am not sure if this is what you want, it's just a screen cap. of the Actor Editor page for the retry text actor. o_o" You can see that I set it to reset the game when "touch" is "pressed," but when you actually click on it in Preview mode it doesn't seem to work.
  • quantumsheepquantumsheep Member Posts: 8,188
    Well, from that screenshot I can determine that you need another rule in your controller that says:

    IF attribute 'reset' is true
    then
    TIMER: after 1 second
    Reset game

    So, make a new boolean variable - call it 'reset'

    Then, in your rule shown in your image, *before* the destroy actor rule have a 'change attribute' behaviour that says:

    Change attribute 'reset' to true

    Destroy actor

    That should do it. Let us know how you get on.

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • WolfieEnsaladaWolfieEnsalada Member Posts: 26
    It worked! :D It actually worked! Thank you so much, quantumsheep! ^__^ Without help from you and a lot of other people here in these forums, my game would not have survived this long. xD
  • quantumsheepquantumsheep Member Posts: 8,188
    *does the snoopy dance*

    Great stuff - this community's at its best when helping people learn!

    Best of luck on your game,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • AfterBurnettAfterBurnett Member Posts: 3,474
    I dunn lerned gud.
Sign In or Register to comment.