It looks like you're new here. If you want to get involved, click one of these buttons!
#include "Held.h"
/*
If I would put -right- in the update function 4 old man would make the game crash, but 2 would still work :D :O
*/
orxVECTOR right = {50.0f, 0.0f, 0.0f};
Held::Held()
{
heldobj = orxObject_CreateFromConfig( "Held" );
orxObject_SetUserData (heldobj, this);
orxCLOCK* AnimationClock = orxClock_Create( 0.2f, orxCLOCK_TYPE_USER );
orxClock_Register( AnimationClock, Update, heldobj , orxMODULE_ID_MAIN, orxCLOCK_PRIORITY_NORMAL );
//orxEvent_AddHandler( orxEVENT_TYPE_ANIM, Held::EventHandler );
}
void Held::Update(const orxCLOCK_INFO *_pstClockInfo, void *_pstContext)
{
orxOBJECT *pstObject = orxOBJECT( _pstContext );
Held *prtObj = (Held *)orxObject_GetUserData(pstObject);
if( orxInput_IsActive( "right" ) )
{
orxObject_SetSpeed ( prtObj->heldobj, &right );
orxObject_SetTargetAnim( prtObj->heldobj, "WalkRight" );
}
else
{
orxObject_SetTargetAnim( prtObj->heldobj, orxNULL );
//orxVECTOR right = {0.0f, 0.0f, 0.0f};
//orxObject_SetSpeed ( prtObj->heldobj, &right);
}
}
Comments
You could probably make them pointers in the spiel class and delete them in an unload/exit function later? Something along those lines should work.
At least I've now made my game crash how it should be
I didn't figure out how to get an non-static Held object working though.
But I don't want to bother you with such basic things anymore.
I thank you very much for your help :cheer: