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?
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.
Posts: 962
Reputation: 18,026

Post » Sat Oct 19, 2013 10:36 am

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

for each invisible sprite
pick by comparison; waypoint where waypoint.iid = "nextwaypoint"
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 or on Steam, read this: Review
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 :)
Posts: 3
Reputation: 181

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests