I've been working on my first real AGS game after messing around with the program for a few years (!), and I came across a programming problem I can't seem to figure out.
In my sorry excuse for a puzzle, the player plants a banana peel on the ground so that the enemy walking towards him will stop in his tracks and slip.
Here's my code, the chef is the enemy character:
cChef.Walk(cChex.x+150,cChef.y, eNoBlock, eWalkAnywhere);
if (oBanana.PPCollideswithC(cChef)){
Display("He slipped!");
}
The problem is that the Chef walks right over the banana and goes on his merry way. I'm thinking the problem may lie with the Walk command, but I'm not sure. Any help would be mucho appreciated.
Oh, and I'm using the pixel perfect collision module.
Make sure you do a X and Y coordinate check. Well, that's what I would do to make sure it works.
Where did you put that part of codes?
You need to check the collision continuously, otherwise the check is only on the instance the character starts to walk.
Move the if (){...} collision part to repeatedly_execute() and see if it works.
Yeah, I was messing around with the code some more, and it worked once I plopped it in repeatedly_execute. Thanks for the help though, guys. :]