Scrolling along particular path

Get help using Construct 2

Post » Sat Oct 19, 2013 10:18 am

Hey guys, little new to Construct

I was wondering how I could go about scrolling along a set path? I figured a good option would be to have an invisible sprite move along a dictated path, and then have the system scroll to that, but I'm not sure about how to set a path for that object. Any pointers?
B
3
Posts: 3
Reputation: 181

Post » Sat Oct 19, 2013 10:30 am

You're correct in your thinking of using an invisible sprite. There are a couple ways you can do the sequence of moves. I like having a variable I use for a timeline and changing that once the camera reaches where it needs to go. So when you want it to start, set Timeline=1. Then have an event going

Timeline=1, Set Camerasprite.X to Camerasprite.X+100*dt.
-----subevent: If Camerasprite.X > 650, set Timeline to 2

And then conitinue with your second set of actions with Timeline = 2 and so on. You can modulate the X and Y position through adding or subtracting the amount you want per second (hence *dt in the event for 100 pixels per second gradually). You can also change the zoom level with System Scale doing the same stuff. You can even get fancier with your movements and use lerp instead of just adding or subtracting. Some people like using the bullet behavior on their moving sprite, but it is just as simple to not.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sat Oct 19, 2013 10:36 am

conditions:
invisible sprite - overlaps waypoint
invisible sprite variable "nextwaypoint" < waypoint.iid
action:
set invisible sprite variable "nextwaypoint" to waypoint.iid+1

event:
for each invisible sprite
subevent
pick by comparison; waypoint where waypoint.iid = "nextwaypoint"
action:
set invisible sprite angle towards waypoint.x waypoint.y

that should do it
for smoother transition use rotate towards waypoint.x waypoint.y instead with a small angle
the sprite will go from the first waypoint it touches to the one that was created after the touched one, so keep that in mind when building your pathmindfaQ2013-10-19 10:41:54
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sat Oct 19, 2013 12:53 pm

Cheers guys! I ended up going with C-7's solution, works great :)
B
3
Posts: 3
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 48 guests