Public Member Functions | Properties

game_object Class Reference

游戏对象基类,用于关联自定义游戏类 More...

List of all members.

Public Member Functions

def __init__
 构造函数,重载请不要带参数,可另写一个init函数传入参数.
def destroy
 销毁函数.
def after_load
 载入场景后会调用此函数,子类中可重写,用于进一步的参数调整.
def set_sce_obj
 将游戏对象中的场景物体替换,该游戏对象需在编辑器场景管理中
def destroy_iphy_obj
 销毁 iphy_obj 对象.
def destroy_iphyex_obj
 销毁 iphyex_obj 对象.

Properties

 name = property(_get_name, _set_name)
 游戏对象名称,读写.
 sce_obj = property(_get_sceobj, None)
 场景对象,只读.
 iphy_obj = property(_get_iphy_obj, None)
 物理对象,只读.
 iphy_ex_obj = property(_get_iphyex_obj, None)
 物理对象,只读.
 pid = property(_get_pid, None)
 游戏对象标识,如果为-1则未加入编辑器场景管理,只读.
 module_name = property(_get_module_name, _set_module_name)
 对应模块名,读写.
 class_name = property(_get_class_name, _set_class_name)
 对应类名,读写.
 pos = property(_get_pos, _set_pos)
 统一的2D世界坐标,不论关联2D还是3D场景物体,此坐标以2D世界平面为准.
 usr_data = property(_get_usr_data, _set_usr_data)
 自定义属性,读写.

Detailed Description

游戏对象基类,用于关联自定义游戏类


Constructor & Destructor Documentation

def __init__ (   self )

构造函数,重载请不要带参数,可另写一个init函数传入参数.

可参考demo进行.


Member Function Documentation

def destroy (   self )

销毁函数.

def after_load (   self )

载入场景后会调用此函数,子类中可重写,用于进一步的参数调整.

例如可用于调整iphy_obj的一些参数.

def set_sce_obj (   self,
  obj_type,
  file,
  layer_id = 0 
)

将游戏对象中的场景物体替换,该游戏对象需在编辑器场景管理中

Parameters:
obj_type:资源类型EMPTY_OBJ, IMAGE2D_OBJ, MODEL2D_OBJ, SPRITE2D_OBJ, MODEL3D_OBJ
file:str 资源路径
layer_id:int 层号
def destroy_iphy_obj (   self )

销毁 iphy_obj 对象.

def destroy_iphyex_obj (   self )

销毁 iphyex_obj 对象.


Property Documentation

name = property(_get_name, _set_name) [static]

游戏对象名称,读写.

写名称请用ieditor2d.rename_gameobj函数,否则不能使用ieditor2d.gameobjname这种方式获取游戏对象.

sce_obj = property(_get_sceobj, None) [static]

场景对象,只读.

对应于image2d,model2d,sprite2d,model3d等对象.

iphy_obj = property(_get_iphy_obj, None) [static]

物理对象,只读.

iphy2d.body 通过碰撞体编辑增加的物理对象,建议不要和 iphy_ex_obj 对象共存.如果物理对象只用于碰撞,则该方式更 简单易用.

iphy_ex_obj = property(_get_iphyex_obj, None) [static]

物理对象,只读.

iphy2d.body 通过物理编辑插件增加的物理对象,建议不要和 iphy_obj 对象共存.物理编辑插件提供了更丰富的物理编辑。

pid = property(_get_pid, None) [static]

游戏对象标识,如果为-1则未加入编辑器场景管理,只读.

module_name = property(_get_module_name, _set_module_name) [static]

对应模块名,读写.

class_name = property(_get_class_name, _set_class_name) [static]

对应类名,读写.

pos = property(_get_pos, _set_pos) [static]

统一的2D世界坐标,不论关联2D还是3D场景物体,此坐标以2D世界平面为准.

更改此坐标会更新sce_obj的坐标及iphy_obj的坐标 (float, float),读写

usr_data = property(_get_usr_data, _set_usr_data) [static]

自定义属性,读写.

该字段用于DIY ieditor2d,是python的字典类型

 All Classes Namespaces Functions Variables Properties