3d adventure, interacting with objects, types,

Blitz3D Forums/Blitz3D Beginners Area/3d adventure, interacting with objects, types,

hohde(Posted 2005) [#1]
I'm currently trying to figure out a smart way to let the player interact with the 3d world's objects. These objects would probably be stuff like say, containers, lights, npcs. The idea is that the player can use these objects, pick them up, talk to them or combine other objects(from the inventory) with them. Normal adventure game stuff, but I'm not sure how should I aproach this.

Currebtly I'm using mouse to pick them, but I don't know how to "tell" the object what I want it to do. Maybe I need to add this type a field, which tells it what the player is after and how to react, but how would I access that, since It seems I'm actually picking just the mesh of this object?


semar(Posted 2005) [#2]
Well once you picked an entity, you could access to a type item associated with it.

For example, you could create your entities and store the entity # in a type structure; later, when you pick an entity, you can scan the type list until you find the one picked.

my_new_entity = createcube() ;create a new entity
list = new t_list ;and a new type element which stores info
list\entity = my_new_entity ;assign to the field entity the entity#

;later: scan the entity list
picked = entitypick(.....)
if picked then
   for list.t_list = each t_list
      if list\entity = picked then
        ;read the entity info here
        exit
      endif
   next
endif



Hope it has sense for you,
Sergio.


Stevie G(Posted 2005) [#3]
This should give you a starting point. I would store the type handle in the entityname and the type instance can be easily retreived using the Object command ...

Note that by using STR$() to display the type instance you can see all the associated field values.

Hope this helps.




hohde(Posted 2005) [#4]
Thanks guys! That looks very helpful indeed. I should be able to make some progress now.