GameMaker Drawing numbers per second

B

Bokkie2988

Guest
Hello,

Currently I am working on a cookie clicker-like game. I am trying to draw the cookies per second, but what happens now is the amount of cookies that need to be added every second are added all at once. But I want them to be added per cookie, for example: 234, 235, 236, 237 and not: 234, (one second later) 237.

How do I do this?

Thanks,

Bokkie
 
T

Taddio

Guest
Read on the Alarm event and how to properly use it. Given the clarity of the question, this is the best answer you can get, right now.
 

AZAMATIKA

Member
Create:
cookie_timermax = 1;
cookie_timer = cookie_timermar;

Step:
cookie_timer = max(cookie_timer - 1/room_speed, 0);
if cookie_timer == 0
{
cookie += 1;
cookie_timer = cookie_timermax;
}

Dunno :O
 
E

Edwin

Guest
Use alarms or ticks.

Alarms:
Code:
/// Create event
cookies = 0;
alarm[0] = room_speed; // room_speed is one second in real life.

/// Alarm 0 event (see in Alarm events)
cookies ++; // add 1 cookie;
instance_create(x, y, cookie); // Create or draw a cookie (do what you want here)
Ticks:
Code:
/// Create event
cookies = 0;
tick = 0;

// Step event;
tick ++;

if ((tick mod room_speed) == 0) {
    cookies ++;
    instance_create(x, y, cookie); // Create or draw a cookie (do what you want here)
}
 
Top