The Dink Network

Mouse Braaaiiinnssss...

April 10th 2011, 07:05 AM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
Um, in my DMOD, there's a small bit where Dink turns into a mouse pointer again. At the title screen, I used keep_mouse or whatever it is before set_mode(2);. So yeah, later on he turns back into the mouse cursor. There's a button which changes him back to Dink, but I can't seem to get it to work. This is my code thing:
//Returns dink to his body

void main(void)
{
sp_nodraw(&current_sprite, 1);
sp_brain(&current_sprite, 14);
}

void click(void)
{
sp_base_walk(1, 70);
sp_base_attack(1, 100);
set_mode(2); 
sp_dir(1, 2);
sp_que(1, 0);
sp_noclip(1, 0);
sp_brain(1, 1);
sp_nodraw(1, 0);
sp_x(1, 320);
sp_y(1, 360);
freeze(1);
say_stop("Phew, back to my old body!", 1);
unfreeze(1);
}


But when I click on it nothing happens. What am I doing wrong?
April 10th 2011, 07:24 AM
spike.gif
Buttons require sp_touch_damage(&current_sprite,-1) in void main(), I think. Maybe. Maybe not. But perhaps.
April 10th 2011, 07:47 AM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
Yes. 'Tis true, 'tis working, 'tis good! Thanks dude! I swear it didn't say anything about that in the DinkC reference...

EDIT: Also, is there a way to check if the mouse button is being held down? So clicking does one thing, holding down the mouse button does another?
April 10th 2011, 08:16 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
No, you can only do the mouse_over thing and the click function, not held down
April 10th 2011, 08:30 AM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
Ah, fair enough. I'll just make it randomly choose one of the effects whenever you click then. Thanks for the info!
April 10th 2011, 09:20 AM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
Oh, and one last question about mice (mouses?)... (I would do this as an edit, but then it might not get seen).

Is it possible to do something no matter where the mouse clicks? So it doesn't matter where you click, it always happens. Like a 'void stageclick(void)' or anything like that? Otherwise I'm gonna have to paste a bunch of invisible sprites with the script across the screen, which I'd rather avoid as the script creates 3 more variables.
April 10th 2011, 10:26 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Create one sprite that fills the entire screen and put its depth que under that of the other buttons, so it reacts to clicks that are not on other buttons?
April 10th 2011, 10:42 AM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
Nice idea, I'll go do that...
April 10th 2011, 01:45 PM
dinkdead.gif
I did that in Bug Mania, take a look at the first level if you like

And if you haven't already made one, feel free to nick the 600x400 sprite I made there (clicker-01.bmp).
April 10th 2011, 03:04 PM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
Actually, that wasn't working for me. I tried making a hardbox for an unused sprite fill the screen, but then for some reason that made the title go glitchy. Also, even with low depth que, it still seemed to get in the way of buttons... I just filled the screen with an invisible church and a few invisible benches in the end. Seems to be working fine, far as I can tell...

By the way, Bug-mania is really cool . I might try making something like that one day, whenever I run out of things to do/make...