I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: Taprus on September 21, 2015, 01:36:56 PM

Title: show step counter
Post by: Taprus on September 21, 2015, 01:36:56 PM
So im making an avoidance, and to make stuff easier to myself i decided that i should have an object that shows the step counter(or step "blocks" idunno) of the timeline. Thing is, even after trying a lot of stuff, it still hasnt worked. Can anyone help me please?
Title: Re: show step counter
Post by: Sudnep on September 21, 2015, 01:48:17 PM
Create an object > Draw Event

Code: [Select]
draw_set_alpha(1);
draw_set_color(c_black);
draw_text(x,y,boss.STEPCOUNTER);

Will draw the text wherever you place this object. Varies depending on h/v text alignment.
Obviously replace "boss" with whatever object the counter is running in and "STEPCOUNTER" with whatever your counter is called.
Title: Re: show step counter
Post by: Taprus on September 21, 2015, 01:58:57 PM
(https://i.imgur.com/gPgv2yt.png)
I think i did something wrong...
Title: Re: show step counter
Post by: Sudnep on September 21, 2015, 02:19:12 PM
The object you created is called stepshower.
The variable you're trying to reference from objAvoidance is called stepshower.
Make the object stepshower unique by changing the name to objStepshower?
Title: Re: show step counter
Post by: Taprus on September 21, 2015, 02:31:29 PM
I dont understand, what is supposed to be the variable from the boss?
Title: Re: show step counter
Post by: Sudnep on September 21, 2015, 02:36:22 PM
Are you using the built in timeline in gamemaker?
(https://puu.sh/kjk72/74f0a07fdf.png)

Or are you using something like this
Code: [Select]
STEPCOUNTER += 1
switch(STEPCOUNTER) {
case 1:
 rngCherryAttack();
break;
}
or this
Code: [Select]
STEPCOUNTER += 1
if STEPCOUNTER = 1 { rngCherryAttack() };

----------------------------

If you're using the built in timeline's provided by gamemaker (im dumb and mis-read what you typed. this is probably what you want):

Code: [Select]
draw_set_alpha(1);
draw_set_color(c_black); // change color depending on what the background color is
draw_text(x,y,object.timeline_position); // change object to whatever object is running the timeline
Title: Re: show step counter
Post by: Taprus on September 21, 2015, 03:01:21 PM
Wow, thank you, it works now!  :atkHappy: I was using the built in timeline function.
Im just bad with GM, so yeah