Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Side-scrolling send troop kind of game template

Twayne2Twayne2 Posts: 315Member, PRO
edited December 2017 in Working with GS (PC)

Anyone got one? I mean, before I maybe start to make a game like this myself. :smile:


  • JCHEREJCHERE Posts: 10Member, PRO
    edited December 2017

    Hi Twayne

    I can't find the file I used but it was posted by socks somewhere with an idea inspired by ?was it Tatiang?

    You can try this format

    Game attributes

    • gameX (real)
    • gameY (real)
    • gameR (real)
    • OffsetY (real)

    Actor 1 - "parent actor" or the main thing that scrolls around

    Constrain attribute: game.gameX to self.positionX
    Constrain attribute: game.gameY to self.positionY
    Constrain attribute: game.gameR to self.rotation

    When touch is pressed
    Change attribute: set game.OffsetY to game.mousepositionY-self.positionY
    Constrain self.positionY to min(400,max(200,game.mousepositionY-game.OffsetY))
    --> 400 and 200 are the limits of your scrolling so it doesn't overscroll

    Actor 2 - or as many as you want - these are the clickable windows inside your scrollbar

    Actor attributes

    • mag (real)
    • angle (real)

    Change attribute: self.mag to magnitude(game.gameX-self.positionX,game.gameY-self.positionY)
    Change attribute: self.angle to vectorToAngle(self.positionX-game.gameX,self.positionY-game.gameY)

    Constrain attribute: self.positionY to self.mag*sin(self.angle+game.gameR)+game.gameY


    This should allow it to scroll up and down
    Haven't tested it myself but I'm assuming if you change the appropriate 'Y's to 'X's you can move it sideways instead

  • Twayne2Twayne2 Posts: 315Member, PRO
    edited December 2017

    Thanks, but that was not my question. My question was if anyone had made a template for that kind of game.

  • smurftedsmurfted Posts: 494Member, BASIC
    edited December 2017

    Yes there are a few... So its definitely possible.

  • tatiangtatiang Posts: 11,457Member, Sous Chef, PRO, Senior Sous-Chef

    I wish but no, it wasn't me.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Twayne2Twayne2 Posts: 315Member, PRO

    @amurfted Can you tell me where?

Sign In or Register to comment.