Sprite aligned with slopes/hills?

0 favourites
  • 12 posts
From the Asset Store
Complete game or template for a hill climb racing model.
  • Hey!

    I'm making my first game, a platformer and I'm trying out some different mechanics and try to learn as much as possible about the program.

    Currently the moving sprites move on flat surfaces smoothly, but when they go up- or downhill they create a wierd looking gap since they only touch the ground with a small part of their animations.

    What I would like is to have my sprites, both enemies and the player move so that when they walk up or down a slope or hill, they automatically face slightly down- or upwards. I havn't really managed to work this out myself and wonder how I should do?

    Worth mentioning would be that I use a "playerbox" for all interactions with the game world and have the player sprite pinned to it with the: "every tick, set position to playerbox"-event.

  • any reason you are using the every tick instead of pinning the player to the box?

    On a side note, usually when people walk/run up a hill, they don't lean back to match the angle of the hill they are walking up, then tend to try and remain straight up and down. But if you go over the tutorials I believe there is one on movement on angles, or it may be a forum post...

    If your animations are not touching the ground when you walk on slopes, you may also want to look into adjusting the animation frames and/or the origin point used for the animation frames and make sure it matches l frames so that your collision box is also steady as well.

  • you could always have an event that sets the player skin (or what the player sees not your playerbox) angle to that of whatever platform the playerbox is on. if you use some sort of collision mask for the levels.

    like say you have a flat platform and a slanted platform, you made the slanted platform by just rotating it in Construct so its angle is now changed. put it in a family (if you have them) and make an event like

    Playerbox is overlaping platform > set playerskin angle to "platform.angle"

    playerskin being the animated sprite you have pined to the box.

  • any reason you are using the every tick instead of pinning the player to the box?

    I'm just very new to Construct2 and I basically followed the guidelines in Ashley's beginners tutorial.

    Thanks for the tips, I'll try it out and see if it works the way I want it to! :)

  • There are a couple beginning paltform tutorials. One of them covers using the pin to object option. Use every tick tends to be a bit more processor intensive as it happens about ~60 a second if I remember correctly...

  • BluePhaze

    I would guess the "pin" behavior does the same thing in the background every tick anyway?

  • Not sure, I have seen refrences to avoid using every tick as much as possible but never seen anythign saying avoid pinning...

  • It doesn't matter if you use pin or every tick.

  • Yes joannesalfa I'm glad you posted that...it was a golden oldie..seriously folks...I know its boring but most of all this stuff was covered explained and well pwned way back....archives are there for good reason...so you can all share the brainiacs of the old school elite at play......joannesalfa being one of them from way back....:-) :-) :-) top work digging up that "old" fossil...oh the joyful flashbacks:-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes joannesalfa I'm glad you posted that...it was a golden oldie..seriously folks...I know its boring but most of all this stuff was covered explained and well pwned way back....archives are there for good reason...so you can all share the brainiacs of the old school elite at play......joannesalfa being one of them from way back.... top work digging up that "old" fossil...oh the joyful flashbacks:-)

    Care to reupload the capx somewhere else? It's broken since the new scirra arcade kicked in.

  • here brunosxs i dug out the old file from my archives...thanks to joannesalpha for original post

    https://www.dropbox.com/s/3474u0v9zbwsn5w/platform-movement-with-ramps.capx?dl=0

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