Scroll to, last known position?

Get help using Construct 2

Post » Sat Feb 22, 2014 12:34 pm

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
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Feb 22, 2014 1:20 pm

Pin the invisible object to player sprite.Use scroll to on that invisible Sprite.
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sat Feb 22, 2014 2:24 pm

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.
B
3
Posts: 3
Reputation: 216

Post » Sat Feb 22, 2014 4:04 pm

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...
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Feb 22, 2014 5:13 pm

Isn't this what you tried?
you wrote:"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..."

:lol: :lol: :twisted:
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.
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sat Feb 22, 2014 6:06 pm

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... :oops: :roll: 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.

Image
Image
Image
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sun Feb 23, 2014 8:47 am

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

Event wrote:On Sprite button touch end
sprite button y=(some thing)

action wrote:-Do what ever you want

This way,you can use just one sprite and text object to make as many menus you want.
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Feb 23, 2014 10:36 am

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.

Image
Image
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sun Feb 23, 2014 10:48 am

Don't touch the text object.Touch the sprite button .
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sun Feb 23, 2014 11:16 am

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?
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Next

Return to How do I....?

Who is online

Users browsing this forum: tarek2, Yahoo [Bot] and 26 guests