Side-scrolling send troop kind of game template

Twayne2Twayne2 Member Posts: 458
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:

Comments

  • JCHEREJCHERE Member, PRO Posts: 10
    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

    RULE
    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 Member Posts: 458
    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 Member, PRO Posts: 586
    edited December 2017

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

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

    I wish but no, it wasn't me.

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

  • Twayne2Twayne2 Member Posts: 458

    @amurfted Can you tell me where?

Sign In or Register to comment.