Move Player functions to g_player.c
parent
1b78de537e
commit
7ca5c6275b
@ -1,8 +1,8 @@
|
||||
bin/*.ir
|
||||
codedefs/*.bin
|
||||
src_crap
|
||||
src_oldtest
|
||||
doc
|
||||
fonts
|
||||
sounds
|
||||
sprites
|
||||
textures
|
||||
src_crap
|
||||
|
@ -0,0 +1,48 @@
|
||||
// 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
|
Loading…
Reference in New Issue