ninja dash

Started by phillipPbor, Thu 05/11/2015 04:41:35

Previous topic - Next topic

phillipPbor

do you know that if you double click with your walk button you can see your player "RUN".
so can someone tell me how can you double click to make your player run?
please?
I am new here..
need a musician composer though...

Vincent

You've forgotten the magic word. :cool:

phillipPbor

I am new here..
need a musician composer though...

Vincent

BINGO !!!
To detain a double click of the mouse I would do something like this :

// GlobalScript.ash
Code: ags

#define MOUSE_DOUBLECLICK_RATE  10 // Double click delay 



// GlobalScript.asc
Code: ags

// top of the script
int double_click;

function repeatedly_execute() 
{
  // DoubleClick recognizer
  if (double_click > MOUSE_DOUBLECLICK_RATE)
  {
    double_click = 0;
  }
  else if (double_click)
  {
    double_click ++;
  }
}



function on_mouse_click(MouseButton button) 
{
  if (button == eMouseLeft) 
  {
    if (!double_click)
    {
      // user performed a Single click (walk)
      double_click ++;
    }
    else
    {
      // user performed a Double Click (run)
    }
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
} 


Not tested, however I think there are several ways to achieve that.
I hope it could give you the idea.

phillipPbor

repeatedly_execute() ?  :confused:

GlobalScript.asc(78): Error (line 78): Variable 'repeatedly_execute' is already defined

this is bad.
I am new here..
need a musician composer though...

Vincent

#5
Yes, Indeed.
The function repeatedly_execute() is already defined in the GlobalScript.
You will have to copy the inside of the repeatedly_execute that I wrote and paste it to the Global one.
Same for the function on_mouse_click.

However, in every each room, you can have a different repeatedly_execute from the Global one.
If you need that for a room only, paste everything to a room script.

phillipPbor

#6
but where and how?
can you tell me this easy?
I am new here..
need a musician composer though...

Vincent

I am not sure how to explain that easily.
If you can post your 'GlobalScript' here, I can show you where you will need to do that.

phillipPbor

I think I already did.
I am new here..
need a musician composer though...

Snarky

#9
Nope, you didn't.

It sounds like you're just starting out with AGS. You should begin by having a look at the manual that comes with it (under the Help menu) â€" you can also find it here (slightly out of date, but it shouldn't matter). Go through the tutorial and have a look at the introduction to scripting. (The most relevant bit is here: http://www.adventuregamestudio.co.uk/manual/ags43.htm#repexec)

Making a game is not something that can be done without effort, so we expect people to do a little bit of studying before you come here asking questions.

SMF spam blocked by CleanTalk