How do I limit scrolling and destroy copies in order

Get help using Construct 2

Post » Tue Oct 10, 2017 7:43 am

Hello all! It's been forever since I used C2 and I'm a bit rusty! So I'm trying to create a simple text adventure game, similar to "Lifeline". I came up with the idea of using one sprite (essentially a long image with text boxes), placing smaller sprites over the text and using timers to destroy the sprites to slowly reveal the text.

Question 1 - How do I set a timer to destroy the sprites in order? Right now, all small sprites run an animation and destroy themselves within 3 - 6 seconds. I want the first sprite to run the animation, destroy itself, the process to repeat on the next copy, and etc.

Question 2 - Possibly more complicated - How can I limit the player's ability to scroll only so far as their progress? That is to say, you shouldn't be able to scroll down to see blank space. Any thoughts or suggestions? Is this a feasible way to create a text based adventure? Thanks!

Note: I'm making this for mobile so the visuals/resolution/controls are optimized for mobile. Should work on browser though

https://www.dropbox.com/s/4aoo9g5i5ym0i ... .capx?dl=0

edit: formatting and less words
Last edited by heyguy on Tue Oct 10, 2017 10:15 am, edited 1 time in total.
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Tue Oct 10, 2017 9:50 am

Add an instance variable "id" to your sprite. Set id=1 for the first instance, id=2 for second etc.

On start of the layout:
Pick Sprite with id=1, Start timer, Start animation

On timer:
Sprite destroy
Pick Sprite with next id, start timer, start animation
Check out my awesome game Doptrix
B
17
S
9
G
29
Posts: 515
Reputation: 16,829

Post » Tue Oct 10, 2017 2:36 pm

Thanks @dop2000. I tried and I think I got it half right. The first sprite animated and destroys as intended but that's all that happens.

https://www.dropbox.com/s/45qt8ezvlnse0 ... .capx?dl=0

So I was actually hoping to create an efficient function that automatically destroy the sprites in order, maybe with a loop, instead of me individually picking instances through events. I actually updated my events to reflect the desire to create a convenient function.
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Tue Oct 10, 2017 2:58 pm

Function is a good idea, if you modify it like this, it should work:
Image
Check out my awesome game Doptrix
B
17
S
9
G
29
Posts: 515
Reputation: 16,829


Return to How do I....?

Who is online

Users browsing this forum: PROxMTswatTR, sean080 and 39 guests