Unbounded scrolling camera shake - tutorial

1 favourites
  • 1 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • To make the camera shake (via scroll without any addons needed) anytime - even when against the layout borders - and still always have the viewport completely inside of the layout, do this.

    set the layout to unbounded scrolling;

    add the following event block:

    every tick

    Camera:

    set x: clamp(Player.X,ViewportWidth("Game")/2,LayoutWidth-ViewportWidth("Game")/2)

    set y: clamp(Player.Y,ViewportHeight("Game")/2,LayoutHeight-ViewportHeight("Game")/2)

    "Game" being the layer the player is in.

    Now, anytime you want to shake it, just add the "shake" action to the camera object (which has the scroll behavior), like you'd normally.

    If you wanna get fancier, instead of "setting" the camera's position, tween it over a small amount of time (eg.: 0.15 seconds).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)