Page 1 of 1

Basic question about mouse clicks

PostPosted: Wed Nov 23, 2011 10:22 pm
by clickrush
Hi everyone,

First of all my programming experience is ~0. I made a little shooter game 13 years ago with quickbasic but forgot most of the stuff anyway :)

Now iam messing around with game-editor and it's hella fun. Here's my problem:

I've made some kind of top-down character that runs around in all directions per mouse clicks and changes animations for 8 of them accordingly. It can shoot arrows too... Now I want it to slow down while "aiming", which should be while pressing the left mouse button. First I tried it simple and just made a global variable for the velocity of the actor. Thing is: the actor doesn't slow down during the movement but only for the next movement (move to).

Also I did't find out yet how to check for "mouse button is held down"/"released".

Thx in advance for clarifications and sorry for asking such a simple question but I really searched alot before posting here.

edit: just realized this should be in the "support" section. sorry for that I thought the section is for technical issues only.

Re: Basic question about mouse clicks

PostPosted: Fri Nov 25, 2011 1:01 am
by skydereign
What I usually do is have a variable that holds the click state. When you have the mouse button down, you set it to 1, and when you have the mouse button up event you set it back to 0. That way you can check if it is 1 to run code to have it when it is clicked.

Re: Basic question about mouse clicks

PostPosted: Fri Nov 25, 2011 12:08 pm
by clickrush
almost embarassing for me how simple your solution is haha, :) thx very much