Left mouse button autofire

Game Editor comments and discussion.

Left mouse button autofire

Postby DeltaLeeds » Wed Nov 18, 2015 8:15 am

I've been using game editor for about 5 years, but still I don't know how to do this. :oops:
So I want a code to excecute when the left mouse button is being clicked, much like key down's repeat feature... I tried drag but it didn't seem to do anything... Does it involve getkeystate or something, I'm not sure... Sorry for this noobish question... xD

P.S: It has been a while since someone needed help in the forums... :?
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: Left mouse button autofire

Postby lcl » Wed Nov 18, 2015 3:07 pm

I think your problem is that you're overthinking it.

There is no repeat option for mouse button down event. But we do have a mouse button down and a mouse button up event. Now, let me ask you a question.

What is the state of that specific mouse button between these two events?

EDIT: Also, there's no need for two topics for this :P
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Left mouse button autofire

Postby DeltaLeeds » Thu Nov 19, 2015 5:15 pm

lcl wrote:What is the state of that specific mouse button between these two events?


I want the left click to be down while the event repeats itself. And I want the event to stop when the mouse button is up... I also tried using mouse button down and up but I don't really know how it'll work. xD

lcl wrote:EDIT: Also, there's no need for two topics for this :P


Whoops, did I make 2 topics by accident? If I did sorry for that... :oops:
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: Left mouse button autofire

Postby lcl » Thu Nov 19, 2015 7:17 pm

You didn't really answer my question there. :P I don't want to spoon-feed you the solution to your problem, I'm trying to provoke your brain to create the solution. This question is the first step. Now, let me repeat my question, and this time, try to simply answer it, even if the answer may seem obvious. :D

What is the state of that specific mouse button between these two events (mouse button down & mouse button up)?

jonathang wrote:Whoops, did I make 2 topics by accident? If I did sorry for that... :oops:

Yeah, you did make two topics, but the other one has been deleted already, it seems. No worries :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Left mouse button autofire

Postby DeltaLeeds » Sun Nov 22, 2015 8:41 am

Sorry for the long reply lcl, busy with college stuff as usual...
lcl wrote:What is the state of that specific mouse button between these two events (mouse button down & mouse button up)?
/quote]

Well because you said
lcl wrote:even if the answer may seem obvious

The state of that specific mouse button between the two events:
Still mouse button down? As in pressed?

Sorry if I messed up or misunderstood again. :oops:
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: Left mouse button autofire

Postby lcl » Mon Nov 23, 2015 10:28 am

Yes, correct answer, the button is pressed between those two events.

So, now you know when the button is pressed: the whole time between the mouse button down -event and the mouse button up -event. So that is the time when bullets will have to be launched in to the air. Now that we know the exact time when the ship should be firing, I'd like to ask you this:

Why exactly should the actual firing code be in a mouse button event?

jonathang wrote:Sorry if I messed up or misunderstood again. :oops:

Hey man relax, don't be sorry :D I'm trying to help you, and I'm doing it because I want to, so it'd be silly for me to be upset about anything here :lol:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Left mouse button autofire

Postby DeltaLeeds » Tue Nov 24, 2015 10:49 am

lcl wrote:Why exactly should the actual firing code be in a mouse button event?

Uh, because the mouse button is actually down between the time the mouse button is down and up?

lcl wrote:
jonathang wrote:Sorry if I messed up or misunderstood again. :oops:

Hey man relax, don't be sorry :D I'm trying to help you, and I'm doing it because I want to, so it'd be silly for me to be upset about anything here :lol:


I have to keep remembering that you're a nice person. :lol: I have a knack of not reading stuff properly so it could get a bit embarrassing. :P
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.
User avatar
DeltaLeeds
 
Posts: 693
Joined: Fri May 06, 2011 12:45 pm
Location: In front of my computer.
Score: 38 Give a positive score

Re: Left mouse button autofire

Postby lcl » Tue Nov 24, 2015 4:06 pm

jonathang wrote:
lcl wrote:Why exactly should the actual firing code be in a mouse button event?

Uh, because the mouse button is actually down between the time the mouse button is down and up?

That's not what I tried to ask. Sorry, my question was probably worded a bit weirdly. :P I meant to ask that is there a crucial reason for having the actual firing code in the mouse button event and not somewhere else?

If you want to keep shooting every frame when the mouse button is pressed, won't an event that is run every frame be a better alternative for the actual firing code than the mouse button event itself as it is run just once? Shouldn't the mouse button event be used as a trigger to make another event, a repeating one, start executing?

jonathang wrote:I have to keep remembering that you're a nice person. :lol: I have a knack of not reading stuff properly so it could get a bit embarrassing. :P

Haha :mrgreen: No need to worry :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Left mouse button autofire

Postby Zivouhr » Wed Nov 25, 2015 5:13 am

Great to see Lcl is still visiting the forum and offering tips. 8)
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score

Re: Left mouse button autofire

Postby lcl » Wed Nov 25, 2015 7:16 pm

Zivouhr wrote:Great to see Lcl is still visiting the forum and offering tips. 8)

I never left this forum, I've read every new post and visited the forum if not daily, then at least many times a week. :) I've just rarely had anything to say (or time to write what I wanted to say, it is very time consuming to type things when on mobile).
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Left mouse button autofire

Postby Zivouhr » Thu Dec 03, 2015 6:28 pm

lcl wrote:
Zivouhr wrote:Great to see Lcl is still visiting the forum and offering tips. 8)

I never left this forum, I've read every new post and visited the forum if not daily, then at least many times a week. :) I've just rarely had anything to say (or time to write what I wanted to say, it is very time consuming to type things when on mobile).


Thanks. True that mobile typing doesn't offer the same advantage as a keyboard.
How are your projects developing lately in your spare time? Any new programs you're working on?
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score

Re: Left mouse button autofire

Postby lcl » Thu Dec 03, 2015 8:43 pm

Zivouhr wrote:How are your projects developing lately in your spare time? Any new programs you're working on?

My projects have not developed for some time now. I've not been working on GE things after spring. But soon I'll probably have more spare time and will continue working on things that I've yet to finish. :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest