trouble with void touch proc.
Can you help me? When i type for example:
void touch(void)
{
say("Does this work?", 1);
}
it doesnt work...is there something i can do?
void touch(void)
{
say("Does this work?", 1);
}
it doesnt work...is there something i can do?
You need to give the sprite a touch damage.
Try this:
Try this:
void main(void) { sp_touch_damage(¤t_sprite, -1); //This will make the engine check if dink is touching the sprite } void touch(void) { say("Does this work?", 1); sp_touch_damage(¤t_sprite, 0); //We don't wanna crash the game //So we have to disable touch for a while wait(1000); sp_touch_damage(¤t_sprite, -1); }
I know I'm awesome
EDIT: I think metataraasal covers touch in one chapter of his tutorial, you might wanna check that out.

EDIT: I think metataraasal covers touch in one chapter of his tutorial, you might wanna check that out.
Ok, that worked...but im now doing this mechanically...so just for a "subquest", why do we have to do that?
You wanted to know why you have to add sp_touch_damage? I didn't really understand what you where trying to say but I'll explain that (If that's not it try to make your question clearer).
sp_touch_damage gives a value of how much a sprite will hurt dink upon touch, and is 0 by default. Touch damage of zero means that it wont hurt dink upon touch; it wont even check it for touch and therefore it wont run void touch(). With a value of -1 however the sprite will not hurt dink but still check for touch. DinkC is designed this way because the game would run to slow (maybe not run at all) if the engine had to check if dink is colliding with everything all the time.
If you didn't wait before resuming the touch damage it would call the void touch all the time over and over again and the game would crash (I think).
sp_touch_damage gives a value of how much a sprite will hurt dink upon touch, and is 0 by default. Touch damage of zero means that it wont hurt dink upon touch; it wont even check it for touch and therefore it wont run void touch(). With a value of -1 however the sprite will not hurt dink but still check for touch. DinkC is designed this way because the game would run to slow (maybe not run at all) if the engine had to check if dink is colliding with everything all the time.
If you didn't wait before resuming the touch damage it would call the void touch all the time over and over again and the game would crash (I think).
Thank you iplaydink, im greek so i dont know very good english, thanks for everyone for trying to solve my problem!