This section has been phenomenally useful, thank you. But i have been unable to find the answer to something ive been working on.
I am attempting to make a launcher game such as kitten cannon or toss the turtle. i have been able to make a "power bar" that will expand its width from 0 to 100 but then i am unable to make it go from 100 to 0. i have been making it restart the timer that allowed it to go from 0 to 100 back to 0 which i think players will find annoying.
Any help or suggestions on how to make my "power bar" go from 0 to 100 and then when it reaches 100 to shrink back to 0 and then back to 100....etc would be greatly appreciated.
You sir are a gentleman and a scholar. I thank you.
No problem. Changing the dt * 100 will make the meter go faster (larger number) or slower (smaller number).
Yes i have been fooling around with it, works perfect.
perhaps you or another patron could help me with the compliment problem i appear to be having. it coincides with the power bar in a way.
I am having trouble getting the "angle meter" to move like the power bar. I need the meter to go between 90 and 180 degrees. I can get the bar to bounce back and forth smoothly using the code you provided me with for the power bar, but it refuses to work in between the 90 to 180 degree area.
to be more specific, the angle bar would start at 180 degrees and move up to 90 then back down etc
Remember angles go like this:
East = 0
South = 90
West = 180
North = 270
So if it starts at 180, it can't move "Up" to 90.
Thanks again, i came to that solution as well when i was experimenting, sadly no that does not fix my problem.
the actor in the game is going to be running from the left side of the screen to the right, when he hits an edge the angle meter will appear, so this solution will not work.
do you have any ideas on how to make the angle meter work in this way?
as in going from north to east or east to north, 270 to 0 or 0 to 270
The trick is not using 270, but -90
<img src="smileys/smiley19.gif" border="0" align="middle" /> <img src="smileys/smiley4.gif" border="0" align="middle" />
thank you so much for your help ArcadEd.
Develop games in your browser. Powerful, performant & highly capable.
No problem and if you need to get a positive value from the meter you can use abs(power) to make it positive and int(abs(power)) to make it a positive int value :).
Sorry to bump an old thread but this is the closest example I could find to what I'm trying to achieve so thank you ArcadEd!
Is there any way I can move the angle bar around and change the angle? I've tried rotating the bar but it still only moves between 0 and -90 when I preview.
Basically, I have a cannon that fires balls into goals, but they have to bounce off of walls and avoid obstacles to hit the goal. In different levels I'd like to reposition the cannon and the angle it points towards. The cannon will rotate and the user needs to touch a button twice, first to stop the cannon moving (so selecting the angle to fire in) and then a power bar will appear moving from 0 - 100, the 2nd touch select the power the ball is fired at.
In some levels the cannon may be at the bottom and the goal at the top with various obstacles in between, in other levels I may put the cannon at the top or middle, or change which way it faces or points towards but it will always only move by 90 degrees. Is it possible to do this in a drag/rotate fashion from a design point of view to make it quicker and easier for me to increase the number of different layouts or levels?
Or would I need to create a different cannon for each level with customised angles that this particular cannon can rotate/fire between?
Hope I've explained myself well! Thanks in advance for any advice.