Sprite aligned with slopes/hills?

Get help using Construct 2

Post » Sat Feb 16, 2013 12:08 am

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.
B
9
Posts: 12
Reputation: 561

Post » Sat Feb 16, 2013 12:53 am

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.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Sat Feb 16, 2013 12:43 pm

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.
B
22
S
5
G
1
Posts: 81
Reputation: 2,271

Post » Sat Feb 16, 2013 1:33 pm

[QUOTE=BluePhaze] any reason you are using the every tick instead of pinning the player to the box?[/QUOTE]

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! :)
B
9
Posts: 12
Reputation: 561

Post » Sat Feb 16, 2013 6:47 pm

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...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Sun Feb 17, 2013 12:29 am

@BluePhaze
I would guess the "pin" behavior does the same thing in the background every tick anyway?
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Sun Feb 17, 2013 3:54 am

Not sure, I have seen refrences to avoid using every tick as much as possible but never seen anythign saying avoid pinning...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Sun Feb 17, 2013 4:07 am

It doesn't matter if you use pin or every tick.shinkan2013-02-17 04:08:17
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Sun Feb 17, 2013 4:26 am

B
96
S
25
G
20
Posts: 3,053
Reputation: 22,640

Post » Sun Feb 17, 2013 12:35 pm

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:-)
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
29
S
11
G
8
Posts: 313
Reputation: 7,335

Next

Return to How do I....?

Who is online

Users browsing this forum: Braus, jul, nimos100, Yahoo [Bot] and 17 guests