Sidescroller, plane kept level with camera?

ipe 369

  • Posts: 1001
God dammit, problem after problem, havin' a bad week.
right, basically, this is probably poop easy to you lot, but i've never made a sidescrolly game thing, so, how do i keep the plane level with the scrolling camera, without having it being pushed back? Also, don't just say set the speed to the same of the camera, doesn't work because it's never perfect... i always get an annoying jittery movement because the cam moves forward then the player moves forward...

Badger

  • Posts: 128
Have you tried making the camera follow the actor?

ipe 369

  • Posts: 1001
no no, i don't want that, that would mean when you moved forwards so would the camera, and you could move backwards in the level. Have you ever played a traditional side scroller?

Badger

  • Posts: 128
Sorry then, not much of a stencyl expert myself :( I'm afraid I can't help you there

Luyren

  • *
  • Posts: 2807
You mean like the original Super Mario Bros? Couldn't understand exactly what you need, but here goes anyway.
Attribute:
Old X: number (hidden)

Always
-If [Old X] > [X of camera]
Move camera to x:[Old X] y:[Y of Camera]
-
Set Old X to [X of Camera]
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

dtrungle

  • Posts: 1938
You're setting the camera by changing it's x/y value right? So when that happens, change the x/y of the plane as well.

ipe 369

  • Posts: 1001
Yeah, both of you, that's what i was thinking, but you can't change it exactly, x position doesn't handle fractions, just rounds em down, whereas the camera does. So, i just checked when the distance moved becomes 1, then added that on. However, i'm still getting a jittery movement...

ipe 369

  • Posts: 1001
S'fine! Got it workin'. Just moved the changing camera pos block to inside the if distance moved > 1.
Thanks for yer time:)

jguarShark

  • Posts: 80
Hi, my apologies for opening up an old thread, but I'm having the same jittery issues and I'm wondering if you (ipe 369) could post a more in-depth explanation of how you fixed it.

Maybe a screen shot of the code?

Thanks in advance!

MrD69

  • Posts: 235
Don't make the camera follow the actor, but make the actor follow the camera. You need a code block to look like this:

Then make a scene block which moves the camera. Like this:
Games: Arrow Mania, Breakout/Outbreak, Water Drop

MrD69

  • Posts: 235
Another alternative is making the Main Actor affected by gravity. Set the Scenes gravity to left or right with a constant number. Make the camera follow the actor, and it will not be able to go as you say in reverse.
Games: Arrow Mania, Breakout/Outbreak, Water Drop