Forums

OverviewV-Play 1 SupportAnchor wall to bottom of screen not working. › Reply To: Anchor wall to bottom of screen not working.

OverviewV-Play 1 SupportAnchor wall to bottom of screen not working. › Reply To: Anchor wall to bottom of screen not working.
#6952

Alex
V-Play Team

Hi,

the reason for this is that you used a anchor for positioning the level:

anchors.fill: parent

If you try to speed up your boat while it is still anchored it won’t move either :)

So instead use:

height: parent.height
width: parent.width
// x: parent.x is default and same for y

But another problem that you run into with your approach is, that you will still not be able to move the collider of the ground this way.

The Box2D physic is using the colliders internal x and y value as their position relative to the world. Now that your ground is NOT moving inside it’s parent (the level), the internal x and y values will stay constant and the ground collider stays on the bottom of the screen.

Now depending on your use case you have several options for this scrolling kind of gameplay:

1. Put the player inside the moving level too, like we did in Chicken Outbreak, and declare the level as entity container.

2. Instead of moving the whole level, move the ground entity explicit. If you have a lot of entities to move, this could have a performance impact though, since every entity needs its own MovementAnimation.

3. If the bodies that you are moving are dynamic and not static, you can apply a velocity to them instead.

If you can describe your exact use case, we can figure out the best solution for you :)

Cheers,
Alex

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support