How do I Create a power meter

Get help using Construct 2

Post » Thu Feb 11, 2016 2:46 am

Hey, I was wondering if you guys could point me in the direction of creating a power meter that fluxuates, as in, a little "cursor" goes up and down on the power meter and depending on when i press the activate button, the cursor stops, and the meter logs the value associated with that area on the meter. I would like to make a simple little game and that would be the perfect system to build it on. Thanks!
B
3
Posts: 7
Reputation: 195

Post » Thu Feb 11, 2016 3:14 am

on event move (image +1 )
like while mouse over
on even end set position to org. location
B
29
S
13
G
10
Posts: 355
Reputation: 8,317

Post » Thu Feb 11, 2016 3:46 am

All you need to do to log the position is to know the Y values from start to finish in the meter area and translate those values to your reading value. Then you just grab the current Y value (assuming X is constant) with Pointer.Y stored in instance variable that you compare with your actual values.. ie Y for meter = 100-300 you could output using Pointer.Y = <50 text = POWER: 100% or whatever...

If your meter was exactly 100 pixels tall (or wide.. using X instead) it would be easy to translate to a 1-100% value to post to player (or show on meter) using (gulp) math... say you use Y pixel value 200-300 you could simply assign the Pointer.Y to a variable and subtract 200 for a 1-100% value... etc otherwise you would need to use complex math or a long series of value = result = value conditions.

You could use a SINE behavior to make the pointer actually move up and down and use stop SINE behavior to make it stop at any point you choose.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Thu Feb 11, 2016 6:31 pm

Thanks guys
B
3
Posts: 7
Reputation: 195


Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223, PROxMTswatTR, ST314 and 24 guests