Layout Progress Indicator

Get help using Construct 2

Post » Sat Jan 04, 2014 1:48 pm

[QUOTE=RamPackWobble] One coffee later and a bit of a code tidy...

https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/scroller%20gauge.capx

[/QUOTE]

Awesome! You are legend! (coffee is amazing isn't it?)

Your solution is great, especially removing the need for the progress bar - less sprites is always good!

I make use of instance variables a lot in the game, but I would never come up with what you put together there.

I have made a note to add you to the credits when the game is completed.
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Sat Jan 04, 2014 1:53 pm

@Colludium.

Thanks for your input, I will give this a try tomorrow as well.

It's after midnight here and it has been a very long day. I don't even think coffee will keep me awake now! So off to bed...


Thanks to all for taking the time to work this out.
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Sat Jan 04, 2014 2:00 pm

I see you've been helped already, but just to show you how close you actually were yourself:

progress indicator improved

I only changed two lines to take the 384 and the arrowheight into account.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jan 04, 2014 10:38 pm

@LittleStain - thanks for that, good to know I was on the right track.

@Colludium - thanks again, gave your suggestion a try and it also works pretty well.

@RamPackWobble - again just to say your solution is perfect.

Since your solution makes good use of both Instance and Global variables I reckon this would make a great tutorial, or addition to new capx examples section. Maybe others can benefit from this.


Many thanks again for all the help - you people are awesome!michael2014-01-04 22:39:13
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Sun Jan 05, 2014 11:54 pm

Just a little update here for the benefit of anyone who wants to impliment something like this in their game.

RamPackWobble solution as already stated is perfect - well almost perfect!

In the game I want to implement this gauge in, it is important that the scroller starts in the middle of the viewport (which was not portrayed in the example capx), and this throws the calculations out a bit.

But if you stop the scroller at the top of the layout it gives a reliable stoping point for the arrow on the gauge.

I spent some hours trying to work the math out..... thank goodness for the cricket!

But I have spent way to much time on this, time to get on with the game itself. Will come back to it later.
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Mon Jan 06, 2014 7:39 am

Mentioning the cricket ? Are you sure you want my help ?    

I forgot to allow for it not starting at (almost) ground level.

Change

(((LayoutHeight-gvScrollersStartingHeight)-Scroller.Y)/(LayoutHeight-gvMaxHeight))

to

(((LayoutHeight-gvScrollersStartingHeight)-Scroller.Y)/(LayoutHeight-gvMaxHeight-gvScrollersStartingHeight))

this will use the (hopefully) correct (distance travelled)/(distance to travel) rather than what is was doing now I've typed that it doesn't look right...I will look again later when I've got more time

and don't forget to set gvScrollerStartingHeight to the correct position .


Perfection ?

(In this version the gvScrollersStartingHeight is only set after a reset...also not a good idea to have it running the calculation every tick (maybe find a way to do this only during flight?))RamPackWobble2014-01-06 07:54:07
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Mon Jan 06, 2014 10:46 pm

[QUOTE=RamPackWobble]Perfection ?

(In this version the gvScrollersStartingHeight is only set after a reset...also not a good idea to have it running the calculation every tick (maybe find a way to do this only during flight?))[/QUOTE]
@RamPackWobble, I can't thank you enough! The math looks so simple when you see it....

Perfection? That will certainly do!

Every Tick? Yeah I was wondering about that, will look into it..


When I first decided to implement this kind of gauge it seemed simple enough, but in practice it was certainly putting my head into a spin!

I really think your example would make great tutorial, an explanation of arriving at the calculation, along with the order of things in the event sheet, would be great for learning from.


Many thanks.

Oh, did I mention the cricket.... my bad! michael2014-01-06 22:49:09
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests