Jump to content

Drawing tiles around entities


Recommended Posts

Posted

The position you get is anchored South-West, so if the entity is 2x2, your position will be the SW corner.
Use the entity size along with the anchor position of the entity to construct the area or polygon.

Entity has the getSizeX and getSizeY methods used to get the tile dimensions of an entity, tho unfortunately it's only properly implemented in the RS2Object related entities. If you want to do it for NPCs you will either need to hardcode the size, or do some hacky calculations with the model

  • Like 1
Posted
13 minutes ago, FrostBug said:

The position you get is anchored South-West, so if the entity is 2x2, your position will be the SW corner.
Use the entity size along with the anchor position of the entity to construct the area or polygon.

Entity has the getSizeX and getSizeY methods used to get the tile dimensions of an entity, tho unfortunately it's only properly implemented in the RS2Object related entities. If you want to do it for NPCs you will either need to hardcode the size, or do some hacky calculations with the model

Thanks, had a hunch it won't be easy.

Tried getSizeX() and getSizeY() (both deprecated) on npcs earlier but they returned wrong values.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...