Jump to content

[SOLVED] Collisions


xtreampb
 Share

Recommended Posts

ok i got the physics and shapes and collisionhook working on my windows. Now my issue is basically casting an entity object to one of my objects. here is what is called on collision

void CollHook(Entity *entity0, Entity *entity1, float *position, float *normal, float speed)
{
if(Stone *mStone=reinterpret_cast<Stone*> (entity0))
mStone->Break();//line here crashes the program. if i comment out this, works no problem

}

 

here is the function that the coll hook object (mStone) calls


void Stone::Break()
{
this->Full->Hide();

this->P1->Show();
this->P2->Show();
this->P3->Show();
this->P4->Show();
this->P5->Show();
}

 

if i comment out all the stuff inside the break function no issues.

 

thank you for your help

 

~Xtreampb~

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

so after some review of an older thread i was able to get things working. my solution is this

 

replace if(Stone *mStone=reinterpret_cast<Stone*> (entity0))

with Stone *mStone=(Stone*)entity0->GetUserData();

 

add this->Full->SetUserData(this);

in your setup routine when your object gets called.

bool Life()
{
 while(death=false)
 {
   if(death==true)
   return death;
 }
}

 

I have found the secret to infinite life

 

Did I help you out? Like my post!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...