V27 entity handling
Displaying 1-3 of 3 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
FR_Patriot

I have a few questions about using entities in V27.

- How can I use an internal entity function (entity.whatever) on an existing, MapEd created entity?

- Can and/or how I move an entity by directly changing its x and y values? If so, then if I move a map-obstructable entity by changing its values onto an obstruction, what will happen?

- What kind of collisions does entity.DetectCollision() detect?



If you help me, thank you for your help. If you read my posts, thanks for taking the time to do so. If you did not even read the post than how the heck did you see this?

Posted on 2001-08-15 22:50:23

ShadowDrak

-map.entities is a python dictionary of all the maped created entities.
I think map.entities["Name you inputed in maped"] will return the entity object.

-you can move entities by modifying their x/y values
entity.x
entity.y
these are their pixel positions on the map
I don't think it cares about obstructions
You'll have to check manually to see if can move there.

-I've never used entity.DetectCollision()
but i assume it detects if the hotspots collide.

-ShadowDrak "Tries to help but usually
screws things up worse"



Posted on 2001-08-16 16:43:25

andy

- Yes. The engine creates a dictionary of entities that live on the map when it loads it, called 'map.entities'. To make some entity or other do something, you can do so:

map.entities['Bob'].Move('U32') # walk 32 pixels upwards

Note that the name, (Bob in this case) is set in the 'name' field of the entity editor within winmaped. Be sure to give each entity a unique name! Eventually, the engine will detect redundant names and auto-change them on its own, but until then, it's up to you. :)

- Yes. Just set their values like any other varaible. This is *unconditional*. The entity is moved precisely where you move it, regardless of map/entity placement.

- Entity/entity collisions. I've found that iterating through a loop in Python to detect such a collision is agonizingly slow. So I provided an interface to a loop implemented in C, which is much, much faster. ^_~



"Ignorance is its own reward" -- Proverb

Posted on 2001-08-16 16:45:56


Displaying 1-3 of 3 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.