How do i rotate the screen off center ?

0 favourites
  • 13 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi guys, i have a problem that keeps me pinned ,

    i want to rotate the layer or layout and i put these events

    System <Every tick >> Set layout angle = layout.angle + 1

    This does it job fine at what its doing however i dont wont the center of rotation to be the middle of the layout , i want it to be the bottom so that i can put a sun and a moon for example and make them appear from the botton of the screen , pass all the way through the sky and then hide again in the bottom

    like this

    x = center of layout rotation

    ________________

            x

    ________________

    ________________

    _______x________

    how do i do that ? thx

  • Unfortunettly it's not possible to set rotations center at the moment.

  • i can't be , my whole game depends on that , there must be a way to rotate something off center

  • ok i think i got it, what if i pin the object that i want to rotate to an object on the layout that is invisible and put a vertical distance between them as much as the layout.height that should mirror the movement but on another position ..,,, wait im going to try it

  • The layer/layout rotate around scrollX, scrollY.

    Those values are the center of your window.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • how do i change these ? i cant find them in the event editor...

  • oh i see ,ok got it i just made the center of x and y an object putt scroll into it and moved everything at the center of the layout and it worked , thanks !!

  • no wait..... i didn't when you rotate the layout it rotates around the center of the layout but when you rotate the layer it rotates around the center of scrolling however i cant make it scroll off center because the center of the screen is always going to be the scroll x and scroll y.....

  • ok i finally found it !!

    How to make an object move circular or elliptical around a center :

    place the object at the center of the movement

    add to it 2 sine behaviors

    change the settings of one to horizontal and the other to vertical

    change at both the magnitute to the same value if you want circular movement or change the ratios between them for elliptical ,

    now chage the horizontal's or vertical's sine period offset at the 1/4 of the period.....voila ! should i post it as a tutorial in the section cause i find it quite usefull ?

  • Are you talking about this:

    ake an object rotate around another via events - LINK

    or this :

    otate a layer and still interact with its physical objects as they appear on screen - LINK

    ?

  • well yes ... now that i saw it i could have used the math formula but its ok i just did it with sine behavior ,,, one more question i made some progress and i have now another problem, when i use the shake action of the object that has scroll everything shakes however i want to exclude some objects... changing layer didnt do the trick , any other ideas ?

  • or simply

    sprite: set X to centerX + cos(angle) * radius
    sprite: set Y to centerY + sin(angle) * radius

    if the radius value is the same for X and Y the sprite will be on a circle of this radius

    if the radius values are different the sprite will be on an ellipse

    That's the basic formula I used for my menu in cubemaze (see below)

    Ok I've been kinda ninja'd on this last one. Shouldn't have taken a shower after opening the topic. well..

    For the "Shake many objects but not these ones" it depends

    If you don't want your HUD to shake you can put all your HUD elements on a layer with parallaxe 0,0 (will never scroll)

    Else you will probably have to shake your layout with a scoll+random(-10,10) and counter shake object you don't want to shake by putting them in the same family and applying the inverse translation.

    +on what  you want
      local number randX = 0
      local number randY = 0
      local number curScrollX = 0
      local number curScrollY = 0
      +System: trigger once
        // store real position on start of shaking
        -> System: set curScrollX to scrollX
        -> System: set curScrollY to scrollY
        -> NoShakeFamily: set self.realX = self.X
        -> NoShakeFamily: set self.realY = self.Y
      +System: every tick
        -> System: set randX to random(-10,10)
        -> System: set randY to random(-10,10)
        -> System: set scrollX to curScrollX + randX      //Shake
        -> System: set scrollY to curScrollY + randY      //Shake
        -> NoShakeFamily: set X to self.realX - randX      //Counter-Shake
        -> NoShakeFamily: set Y to self.realY - randX      //Counter-Shake

    might work :D

  • oh i see, soz but i rly didnt see that anybody else had tried it ,i changed the hud (right guess:)) to another layer and parallax set to 0 and its working fine ,many thnks !

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