Scroll to, last known position?

0 favourites
  • 12 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • So I finally have my player scrolling just the way I want to, but now I have a problem with collisions.

    As you can see in the short vid I uploaded for you guys below, when the player hits something the camera jumps back to the begining of the level. What I want it to do is freeze right there so I can destroy the player sprite(maybe later on add a dead animation), display a "Game Over" text, maybe score etc.

    I've tried various ways, like having another invisible object that follows the player and switching the scroll to that one when the player is destroyed, tried using instance variables, nothing worked...

    Any ideas on how I could achieve this guys? Thank you.

    http://www.filedropper.com/bandicam2014 ... -30-47-260

  • Pin the invisible object to player sprite.Use scroll to on that invisible Sprite.

  • When System health is less than or equal to 0, you could use a System Wait 3.0 seconds and then show your Game Over screen during the Wait period before the System Go to Layout1.

  • Like I said Doc Ai, I already tried that and it doesn't work.

    vfxcorp there is no time to wait, the second the player sprite is destroyed the camera jumps.

    Check the video people so you can see exactly what I mean, I uploaded it for a reason...

  • Isn't this what you tried?

    "I've tried various ways, like having another invisible object that follows the player and switching the scroll to that one when the player is destroyed, tried using instance variables, nothing worked..."

    You don't have to switch the scrollto.Keep the scroll to to the invisible sprite.Before the the player is destroyed,Set global variable Playerx and Global variabel Player y to the corresponding Player.X and Player.Y.

    Then unpin the invisible object.Set it's x and y to global variable.(I think you can also use instance variables)

    Wait x seconds and do whatever you want.

  • Ok, I've finally managed to make it work using the tips you game me, thank you.

    But, as usuall, as soon as you fix one problem another appears... I'll try and see if we can fix it here before creating a new topic.

    I've been reading around and it seems cocoonjs(with which I plan to export my game) doesn't support the button form control that construct 2 has, or the textbox for that matter. So the only option I am left with is list.

    Is there any way I can make some normal buttons(I want to have a menu "start game", "options", etc.) with C2+cocoon so I don't have to resort to the dreadfull list option?

    Basically this is how I've set it up at the moment(still have to position it and add background images, so ignore the way it looks for now) and I would like to keep it like this and preserve the functionality of the diff buttons, but in a way that works with cocoon.

  • Use your own sprite buttons and text objects on top of it.

    On Sprite button touch end

    sprite button y=(some thing)

    -Do what ever you want

    This way,you can use just one sprite and text object to make as many menus you want.

  • Thats the thing(probably should have mentioned this too) when I use sprites/text I don't get any "on clicked" or touch events/actions for them at all. If I could I would have created my own buttons to begin with.(don't really like how the C2 ones look...)

    I've made some screenshots of a selected text object for example, those are all the events/actions I get for it.

  • Don't touch the text object.Touch the sprite button .

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well, I've looked around and tested some more, guess I could use the "on touched object" and "on clicked object" events then for the object I select whichever sprite/text I desire. Those should work just like the "on clicked" event buttons have, right?

  • Well, I've looked around and tested some more, guess I could use the "on touched object" and "on clicked object" events then for the object I select whichever sprite/text I desire. Those should work just like the "on clicked" event buttons have, right?

    Yes,On clicked is for mouse and On touched object is for touch.They work the same way

  • Cool, thank you very much.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)