Panic Metre Based On Mouse Movement?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
crimsonnight
Veteran
Posts: 298
Joined: Fri Apr 20, 2012 4:44 am
Contact:

Panic Metre Based On Mouse Movement?

#1 Post by crimsonnight » Fri Jan 29, 2016 7:56 am

Hi all,

I'm currently working on a short horror VN and had a few ideas that I was wondering would be possible to implement or not.
The main idea I have is to incorporate something like a 'panic metre'. The way I see it working, is as an (invisible) metre that fills the more you move the mouse - so the idea is that you stay calm and keep your hand still during tense scenes. It would have to be detected in the background and not effect gameplay. As the metre fills, I could intensify (raise the volume) on certain SFX and well as intensify (increase the opacity) of certain filters. What do you think, would something like this be possible?

The other idea I had, was using a gradually dimming lamp (brightness (black PNG that gradually increases in opacity?) - when the screen gets too dim, you have to shake the mouse to awaken the lamp and restore full brightness/visibility. Again, would something like this be possible in ren'py?

Cheers =)
alwaysthesamebluesky.com

User avatar
Iylae
Regular
Posts: 73
Joined: Sat Jan 09, 2016 6:57 am
Location: Cornwall, UK
Contact:

Re: Panic Metre Based On Mouse Movement?

#2 Post by Iylae » Fri Jan 29, 2016 8:04 am

I'm not sure how fast you can run a loop in renpy, but using renpy.get_mouse_pos() will allow you to find the mouse position, and from that use simple math in the loop to find out how far the mouse has moved.

I can't help you with the image/sound adjustment though someone will surely point you in the right direction.
Image
  If we are what we repeatedly do, then good coding is not an act, but a habit

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Panic Metre Based On Mouse Movement?

#3 Post by xela » Fri Jan 29, 2016 8:09 am

Iylae wrote:I'm not sure how fast you can run a loop in renpy
Very, very, very fast :)

===>
UDD is best for this task I think. Darkish background will work but you may get an even better result with im. manipulators.
Like what we're doing? Support us at:
Image

crimsonnight
Veteran
Posts: 298
Joined: Fri Apr 20, 2012 4:44 am
Contact:

Re: Panic Metre Based On Mouse Movement?

#4 Post by crimsonnight » Fri Jan 29, 2016 9:09 am

Cheers guys, I suppose instead of using 'renpy.get_mouse_pos()' and seeing how far it moves, it may be better to monitor constant movement (ie the amount of time the mouse is moving/still) as well as how far it's travelled if possible? This'll be necessary for the lamp function outlined. I feel like we have a strong start though ;)
alwaysthesamebluesky.com

User avatar
Iylae
Regular
Posts: 73
Joined: Sat Jan 09, 2016 6:57 am
Location: Cornwall, UK
Contact:

Re: Panic Metre Based On Mouse Movement?

#5 Post by Iylae » Fri Jan 29, 2016 9:24 am

I wonder, does RenPy handle spawning sub-processes? That'd make a mouse monitoring loop much simpler for this effect.
Image
  If we are what we repeatedly do, then good coding is not an act, but a habit

User avatar
Winterslice
Veteran
Posts: 228
Joined: Mon Sep 28, 2015 3:51 am
Completed: The Next World, Golem Creation Kit
Organization: Illuminated Games
Contact:

Re: Panic Metre Based On Mouse Movement?

#6 Post by Winterslice » Fri Jan 29, 2016 9:25 am

Using renpy.get_mouse_pos() in a UDD, you'd be able check the new value against an old one, see how far the mouse has moved in pixels, and make a judgement based on said amount of pixels. It is by far the simplest way of doing exactly what you want. Check out the flashlight UDD in the Ren'Py cookbook for inspiration.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Panic Metre Based On Mouse Movement?

#7 Post by xela » Fri Jan 29, 2016 5:00 pm

Winterslice wrote:Using renpy.get_mouse_pos() in a UDD
You don't really have to, values are supplied to the event method...
Like what we're doing? Support us at:
Image

User avatar
Winterslice
Veteran
Posts: 228
Joined: Mon Sep 28, 2015 3:51 am
Completed: The Next World, Golem Creation Kit
Organization: Illuminated Games
Contact:

Re: Panic Metre Based On Mouse Movement?

#8 Post by Winterslice » Sat Jan 30, 2016 12:49 am

xela wrote:
Winterslice wrote:Using renpy.get_mouse_pos() in a UDD
You don't really have to, values are supplied to the event method...
Interesting. Not sure I understand that part yet. If it's not too much of an imposition, can you give an example?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Panic Metre Based On Mouse Movement?

#9 Post by xela » Sat Jan 30, 2016 9:05 am

Winterslice wrote: Interesting. Not sure I understand that part yet. If it's not too much of an imposition, can you give an example?
Example!
Like what we're doing? Support us at:
Image

User avatar
Winterslice
Veteran
Posts: 228
Joined: Mon Sep 28, 2015 3:51 am
Completed: The Next World, Golem Creation Kit
Organization: Illuminated Games
Contact:

Re: Panic Metre Based On Mouse Movement?

#10 Post by Winterslice » Sat Jan 30, 2016 5:08 pm

Ahhhh, okay, I see it now. Thanks.

crimsonnight
Veteran
Posts: 298
Joined: Fri Apr 20, 2012 4:44 am
Contact:

Re: Panic Metre Based On Mouse Movement?

#11 Post by crimsonnight » Fri Aug 05, 2016 4:34 pm

After chatting with TheSHAD0W on the IRC, he kindly came up with a system to track mouse-movement and build up a metre based on that - I'll attach it to this post to help anyone looking to do a similar thing.
Attachments
panic_meter_test.zip
(7.2 KiB) Downloaded 78 times
alwaysthesamebluesky.com

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]