Page 1 of 1

Left mouse button autofire

PostPosted: Wed Nov 18, 2015 8:15 am
by DeltaLeeds
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... :?

Re: Left mouse button autofire

PostPosted: Wed Nov 18, 2015 3:07 pm
by lcl
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

Re: Left mouse button autofire

PostPosted: Thu Nov 19, 2015 5:15 pm
by DeltaLeeds
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:

Re: Left mouse button autofire

PostPosted: Thu Nov 19, 2015 7:17 pm
by lcl
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 :)

Re: Left mouse button autofire

PostPosted: Sun Nov 22, 2015 8:41 am
by DeltaLeeds
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:

Re: Left mouse button autofire

PostPosted: Mon Nov 23, 2015 10:28 am
by lcl
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:

Re: Left mouse button autofire

PostPosted: Tue Nov 24, 2015 10:49 am
by DeltaLeeds
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

Re: Left mouse button autofire

PostPosted: Tue Nov 24, 2015 4:06 pm
by lcl
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 :)

Re: Left mouse button autofire

PostPosted: Wed Nov 25, 2015 5:13 am
by Zivouhr
Great to see Lcl is still visiting the forum and offering tips. 8)

Re: Left mouse button autofire

PostPosted: Wed Nov 25, 2015 7:16 pm
by lcl
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).

Re: Left mouse button autofire

PostPosted: Thu Dec 03, 2015 6:28 pm
by Zivouhr
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?

Re: Left mouse button autofire

PostPosted: Thu Dec 03, 2015 8:43 pm
by lcl
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. :)