Interactive Objects
Most of the code you will be writing will be contained within Interactive
Nodes. This is because, in PACgd, Interactive
objects are in charge of instructing the Characters
how to behave when interacting with them.
Table of contents
Making an Object Interactive
In order to use an object in PACgd you need two things:
- To attach an
script
to theObject
, and extend the classInteractive
- To add a
CollisionShape
to theObject
, so thePointClick
system can detect it.
The Interactive Class
Interactive
objects have six main properties:
main_action
,secondary_action
: These properties determine what happens when the player clicks on the object using the primary or secondary click (left and right mouse buttons by default).- Its value has to be an
Action
. See actions documentation for options. - The default primary and secondary actions are
ACTIONS.walk_to
andACTIONS.examine
.
- Its value has to be an
interaction_position
: AVector
indicating the spatial position in which theCharacter
must stand to interact with the object.description
: The description of the object when it isexamined
.thumbnail
: The thumbnail to display in theInventory
after the object is grabbed.interactive
: A Boolean flag indicating if thePointClick
system should interact with the object or not.
Actions on an Object
The main_action
and secondary_action
determine the methods the object needs to implement. For example, if the main action is ACTIONS.take
the object must implement the method take(who)
(see Action
documentation). Within such method, the object must call different Characters
methods in order to instruct the Character
on what to do (see Character
documentation). You can find examples on how to do this in our Quickstart tutorial.