Game Development Community

Need help with charging power meter.

by Solo · in Game Design and Creative Issues · 05/11/2009 (10:45 pm) · 3 replies

Hi, I am a newbie to TGB.
I was working on a project which needs to create a power meter that allows the player holding Left-Click on mouse to charge the meter.
I searched around here, and googled, read the docs and tuts and still don't understand how to charge up a power meter by mouse clicking.
Can anyone give me a clue, please?
I learned how to getSimTime from mouse click...just don't know how the power meter thing "charge" up..
Thanks


Solo from W.Australia

About the author

Recent Threads


#1
05/18/2009 (9:54 pm)
Can somebody help me with the problem? please
#2
07/17/2009 (2:09 pm)
Hey Solo,

I would recommend instead of doing the simTime function, I would have a method in the Key Pressed function that += 1 to a variable that is the charge amount with an if that maxed at 100 or so.

Psudocode:

Event LeftMouseButtonPressed {

if (chargeAmount !> 100):
{
chargeAmount += 1;
}

}

This if it is too fast or too slow, change the +=1 to something like +=0.5 or 2 depending
#3
07/17/2009 (9:03 pm)
And, of course, by the "+1" he means "I would use the sim time multiplied by a modifier to ensure that the game plays properly across multiple platforms and machines of varying processing power."

It's always best to count the time into calculations like that. Otherwise, faster systems will do things faster, ergo your gameplay will be different (and possibly screwed up) on platforms of varying degrees of power. (Power in the sense that a hardcore gamer is going to have a rig built that'll make your game cry, while a casual gamer will likely be playing a bit slower than expected.