Forums

OverviewV-Play 1 SupportPositioning entities at center versus topleft (and dragging onto moved levels) › Reply To: Positioning entities at center versus topleft (and dragging onto moved levels)

OverviewV-Play 1 SupportPositioning entities at center versus topleft (and dragging onto moved levels) › Reply To: Positioning entities at center versus topleft (and dragging onto moved levels)
#7398

Alex
V-Play Team

Hi Arend,

I will try to cover all your questions one by one :)

— the not allowed rectangle:
You can simply hide the default rectangle with the showRectangleWhenBuildingNotAllowed property set to false.

— building on 0-coordinates:

You are right, the algorithm considers 0 as out of bounds. However you can outmaneuver this behavior by overriding the “internal” property of the EntityBaseDraggable:

__towerSizeInGridsHalf: colliderSize/(2*gridSize)-1 // the -1 is added to the original calculation

I ran some tests with it and it seems to work flawless.

— offsets:

Since the entities should be created in the level, the entityContainer of the EntityManager must be the level. Also the PhysicsWorld must be inside the level or the colliders will not move accordingly when the level is moved.

— entity origin:

As long as you are not rotating the entity, using the top-left corner is just fine in my opinion.

 

If you are still facing issues, could you create a small demo project that contains the errors and post the code here or send them to support@v-play.net? I can then try to debug them further.

Cheers,
Alex

 

  • This reply was modified 4 years, 2 months ago by  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