This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-18 12:41:13

FINGIN
Scratcher
Registered: 2010-10-19
Posts: 100+

Holding down left mouse button making a difference..ummmm

So basically I just want to hold the left mouse down for a while and eventually it will do what I want it to do but if you/I don't hold it down it won't do it?
ummmmm so i'm working on a game and you click to attack and hold down click to block so what i'm saying is that how do I get it to only register if I hold it down,

I tried with variables but no success,

also he crouches and its S to crouch and so I want it I hold down S to crouch not just press s and then he crouches, and then once I release S he stands up, wow I just realize alot of this game involves holding down.

Last edited by FINGIN (2012-03-18 12:56:50)


Problem officer?       http://trollosphere.legtux.org/wp-content/uploads/2012/01/Troll-Face-4efef98405000.png

Offline

 

#2 2012-03-18 12:54:19

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Holding down left mouse button making a difference..ummmm

Here's my first attempt at scratchblocks:

when gf clicked
forever
     if  < mouse down >
           change variable by 1
     else
           set variable to 0
     end
     if   ( variable > 20 )
           set variable to 0
           Do whatever
     end
end
I hope that helps.

Last edited by pi3 (2012-03-18 12:55:41)


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#3 2012-03-18 12:55:36

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Holding down left mouse button making a difference..ummmm

Try this:

when gf clicked
forever
if<mouse down?>
reset timer
wait until <not <mouse down?> >
end
end

when gf clicked
forever
if <<<mousedown?> and <(timer)>[4.5]> >
wait (.5) secs
if<<<mousedown?> and <(timer)>[4.5]> >
do script
end
end
end
It should be "timer > 4.5"

Last edited by MoreGamesNow (2012-03-18 13:00:07)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-03-18 12:57:51

FINGIN
Scratcher
Registered: 2010-10-19
Posts: 100+

Re: Holding down left mouse button making a difference..ummmm

BUMP, by the way I just edited in a bunch of other questions on mah post


Problem officer?       http://trollosphere.legtux.org/wp-content/uploads/2012/01/Troll-Face-4efef98405000.png

Offline

 

#5 2012-03-18 13:01:08

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Holding down left mouse button making a difference..ummmm

when gf clicked
if<key [s] pressed?>
crouch
wait until <not <key [s] pressed?>>
stand
end

Last edited by MoreGamesNow (2012-03-18 13:01:31)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#6 2012-03-18 13:03:08

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Holding down left mouse button making a difference..ummmm

when gf clicked
forever
    if < s key pressed >
          switch to costume [crouching]
    else
          switch to costume [standing]
    end
end

Last edited by pi3 (2012-03-18 13:03:26)


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#7 2012-03-18 13:04:52

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Holding down left mouse button making a difference..ummmm

MoreGamesNow wrote:

when gf clicked
if<key [s] pressed?>
crouch
wait until <not <key [s] pressed?>>
stand
end

For that one to work, I think you need a forever block around it.

Last edited by pi3 (2012-03-18 13:05:07)


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#8 2012-03-18 13:10:18

FINGIN
Scratcher
Registered: 2010-10-19
Posts: 100+

Re: Holding down left mouse button making a difference..ummmm

THANKS PI AND more games now, both worked great


Problem officer?       http://trollosphere.legtux.org/wp-content/uploads/2012/01/Troll-Face-4efef98405000.png

Offline

 

#9 2012-03-18 13:11:20

FINGIN
Scratcher
Registered: 2010-10-19
Posts: 100+

Re: Holding down left mouse button making a difference..ummmm

I mean for the mouse not the crouch haven't tried those yet but I will know.


Problem officer?       http://trollosphere.legtux.org/wp-content/uploads/2012/01/Troll-Face-4efef98405000.png

Offline

 

#10 2012-03-18 13:16:26

FINGIN
Scratcher
Registered: 2010-10-19
Posts: 100+

Re: Holding down left mouse button making a difference..ummmm

thanks crouch ones worked as well!


Problem officer?       http://trollosphere.legtux.org/wp-content/uploads/2012/01/Troll-Face-4efef98405000.png

Offline

 

#11 2012-03-18 13:21:06

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Holding down left mouse button making a difference..ummmm

Glad I could help!  smile


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#12 2012-03-18 13:55:11

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Holding down left mouse button making a difference..ummmm

pi3 wrote:

Glad I could help!  smile

Yeah, thanks for that.  That was kind of embarrassing xD


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer