49 lines
870 B
C
49 lines
870 B
C
// Copyright © 2017 Project Golan, all rights reserved.
|
|
#include "g_object.h"
|
|
|
|
#include <Doominati.h>
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
//
|
|
// G_Player_Think
|
|
//
|
|
DGE_Callback void G_Player_Think(DGE_Entity ent)
|
|
{
|
|
DGE_Object_RefAdd(ent.id);
|
|
|
|
for(;;)
|
|
{
|
|
if(ent.health <= 0)
|
|
break;
|
|
|
|
ent.vx = ent.vx + (fixed)DGE_GetInputAxis(0, DGE_Axis_X);
|
|
ent.vy = ent.vy - (fixed)DGE_GetInputAxis(0, DGE_Axis_Y);
|
|
|
|
DGE_Task_Sleep(0, 1);
|
|
}
|
|
|
|
DGE_Object_RefSub(ent.id);
|
|
}
|
|
|
|
//
|
|
// G_Player_Create
|
|
//
|
|
DGE_Entity G_Player_Create(fixed x, fixed y)
|
|
{
|
|
DGE_Entity ent = {DGE_Entity_Create(0)};
|
|
|
|
ent.x = x;
|
|
ent.y = y;
|
|
|
|
G_entty const *type;
|
|
if((type = G_ObjDef_GetType("Player"))) {
|
|
G_ObjDef_setupEntity(type, ent);
|
|
G_ObjDef_createTask (type, ent);
|
|
}
|
|
|
|
return ent;
|
|
}
|
|
|
|
// EOF
|