It seems that "CollisionFree()" changes position of an actor. The moveto() function which is executed afterwards
moves even if I specify "0" as value.
Has anyone expierience with the "collisionfree()" function?
Thx
andreas
int n;
Actor *actors;
char *key = GetKeyState(); //Get entire keyboard state
if(xvelocity == 0 && yvelocity ==0)
{
if(key[KEY_RIGHT] == 1) //Test if right key is pressed
{
CollisionFree("Event Actor", x+32, y);
actors = getAllActorsInCollision("Event Actor", &n);
if(n==0 ||(n==1 && !strncmp(actors[0].name,"ground",6)))
MoveTo("Event Actor", 0.000000, 0.000000, 4.000000, "hero", "");
}
if(key[KEY_LEFT] == 1) //Test if left key is pressed
{
CollisionFree("Event Actor", x-32, y);
actors = getAllActorsInCollision("Event Actor", &n);
if(n==0 ||(n==1 && !strncmp(actors[0].name,"ground",6)))
MoveTo("Event Actor", 0.000000, 0.000000, 4.000000, "hero", "");
}
if(key[KEY_UP] == 1)
{
CollisionFree("Event Actor", x, y-32);
actors = getAllActorsInCollision("Event Actor", &n);
if(n==0 ||(n==1 && !strncmp(actors[0].name,"ground",6)))
MoveTo("Event Actor",0.0,-0.000000, 4.000000, "hero", "");
}
if(key[KEY_DOWN] == 1)
{
CollisionFree("Event Actor", x, y+32);
actors = getAllActorsInCollision("Event Actor", &n);
if(n==0 ||(n==1 && !strncmp(actors[0].name,"ground",6)))
MoveTo("Event Actor", 0.0,0.000000, 4.000000, "hero", "");
}
}