Scrolling along particular path

0 favourites
  • 4 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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 path

  • Cheers guys! I ended up going with C-7's solution, works great :)

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