Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, ozgur, Quad), 841 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Mouse Release? #450972
04/26/15 07:41
04/26/15 07:41
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Is there function or variable built into the engine that recognized when a mouse button is released?

I'm really surprised that I have never looked this up, and that it's not in the manual...

Re: Mouse Release? [Re: Dooley] #450976
04/26/15 09:29
04/26/15 09:29
Joined: Dec 2009
Posts: 82
D
Denn15 Offline
Junior Member
Denn15  Offline
Junior Member
D

Joined: Dec 2009
Posts: 82
im pretty sure that there is not however you can check it this way:

Code:
...
while(mouse_left)
{
   wait(1);
}
//mouse is released here
...


Last edited by Denn15; 04/26/15 09:29.
Re: Mouse Release? [Re: DLively] #450982
04/26/15 12:54
04/26/15 12:54
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Code:
var mouse_activated = 0;
...

if(mouse_left && !mouse_activated){
    mouse_activated = 1;//activate the switch
    //The rest of your code here:
}
if(!mouse_left && mouse_activated){
    //your on release code here
    //mouse_activated = 0;//reset te switch
}


Last edited by DLively; 04/26/15 12:55.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Mouse Release? [Re: DLively] #451009
04/27/15 02:05
04/27/15 02:05
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
On top of that you can create a corresponding event yourself which gets triggered on mouse button release, for example as follows:

var mouse_left_off = 0;
Make a loop which deals with player input, then add something like this:
Code:
void handle_input()
{
while(1)
{
  ... keyboard input

  if(mouse_left) mouse_left_off = 0;
  else
  {
    if(!mouse_left_off) mouse_left_off_event(); // 
    mouse_left_off = 1;
  }
  wait(1);
}
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1