Day-Night Cycle | Farming RPG Tutorial: GMS2 [P12]

preview_player
Показать описание
Today we begin our day/night cycle, implementing a basic "time counter" and having our crops grow at the end of the day. Towards the end of the video, we fix a few bugs.

In the next video, we will continue the day/night cycle and implement a lighting system that will allow us to outline different "phases" of the day - night, sunrise, day, sunset - all with their different lighting colours.

Here I am in other places:

Project Download link (onedrive):

*CREDITS

Рекомендации по теме
Комментарии
Автор

Just getting into GMS2 and found this tutorial series!
It is really great, especially for people with existing programming skills.
You really got your stuff organized!
You also got the first video to get beginners going but without any programming knowledge it will be difficult to keep up. But that is not the sake of the series!
I really appreciate your work and will watch all the videos!
It is really a shame that the videos have so few views! Great programming tutorial, keep up the good work!
Greetings from Austria!

Jaultaub
Автор

I actually combined a day-night cycle with your dynamic shadows tutorial to create shadows that grow shorter towards noon and longer towards evening/dawn, and disappear at night. :)
I also used easing scripts for easing the dark for a better effect.

TheRealZen
Автор

I was writing code for a day/night cycle in visual studio and just kept failing because I fell way too far down the rabbit-hole and then I stumbled upon this video and the cloud that bogged down on my mind was lifted. Holy sh*t I felt like such an idiot when, while watching this video it all clicked into place. For this video I thank you. Also please accept my sub.

pixelboi
Автор

I felt like there was a more abstract soluition for the usage of the Room Start switch for determining interior/exterior daycycle lighting. It's fine for a few rooms, but I wouldn't want to manually type in a room list if my room list got very big. Thankfully, all my interior rooms' name start with "rInt". For example "rIntFarm1stFl" and "rIntFarm2ndFl". So I am doing a room name wildcard check of sorts to see if I'm in an interior room

In the Room Start event, I set up a couple local variables:

var roomName = room_get_name(room);
var interior = string_pos("rInt", roomName);

string_pos() returns the position of the substring (Argument 0) in the string (argument 1), or returns 0 if the substring isn't found. So it's a simple if statement:

if (interior == 0)
{
draw_daylight = true;
}
else
{
draw_daylight = false;
}

And no matter what rooms I add, I won't have to change the conditions in the Room Start event.

cchhiipp
Автор

Cycling through different colors sounds great. Inventory + crafting would be so awesome too :D I am really enjoying this series :3

kiptt
Автор

I just wondered, why not simply put planting = false; to the room end event? Might be bettter, if for example I would like to have multiple rooms to plant in. Others than that: I really love this series. You and Shaun Spaldings are true heroes for putting such a huge amount of work in this tutorials. Greetings from germany and stay safe!

Автор

How can i set the start time to be at hours = 12:00 for example? i thought i just declare hours = 12 in the create event but that doesnt seems to work for me?

lurchden
Автор

I Don't use gm but i like the tutorials. I might try it one day

BeerfootBandit
Автор

I probably wouldn't use GUI functions for anything other than the actual GUI, because using it as a base for the lighting doesn't seem like a fool-proof, bug-less, safe approach

maarcislv
Автор

I have issue with crops depth sorting turning out weird and also i cant get them growing when I'm in another room but whatever

vela
Автор

I've tried implementing this in my project and the gui doesn't draw to cover the full display, display_get_gui_height only seems to make the gui little less then 1/4th the screen, everything else is working as expected, anyone know what I'm doing wrong?

WiDEEyeDSmILes
Автор

anyone know how to get the text that appears for the time get bigger its so small ican barely read it

Mystical-TEDDY_
Автор

Edit : And by the way, in old GMs I used to try to do everything without codes as much as possible. Could I do the same in this or Do I necessarily have to learn? Or can I do stuff by both copying what I find and try to learn in the meantime? Or would everything be a mess after a while? Please honest answer :)

Hello. I'm not using any GameMaker for 12-13 years (Since GM6-7) but I'm just checking out what's going on in this field. I think that you're kinda pointing out good details I always wondered like... EVER. Because in gm6-7 times I almost never could find what I was looking for. I was looking for this kinda fancy stuff for the things I'm trying to do. I mean, weren't they possible back then? Or was nobody doing tutorials? I don't know. But the only thing I know is these videos of yours are flaming my love for making games or at least trying :) . I'm still not sure tho If I would get on this train again.

babblebabble
Автор

Great vids! Binge watching these now, and first question has popped up:
At 23:50 when you say the step event happens before the draw event, is that because that's the order you have them in the event list box, or does the step even always happen before the draw event, regardless of the order they are listed in the event list for that object?

Zebitty
Автор

Hi! Thank you very much for you videos! I'm having a problem here, my black rectangle doesn't fit my camera. It lacks pixels at the right side (something like 1cm for the player) and at the bottom (less than 1cm). I tried resizing stuff but it's still here. If anyone might be able to help, I'd be grateful cause I don't really know how to fix it...

mariescherer
Автор

The moment you said we just draw over the gui, I said to myself. The player in the game is living a lie. lmfao . Specifically the player is having Truman show paranoia experience.

professionalquestion
Автор

I just had a question about this, say I wanted my warp object to be accessible and send me to a specific room at a specific time and date, is it as simple as making the variables in the day/night cycle object to be global? Or am I either over simplifying or over complicating this? Sorry if this is an annoying question, I just greatly value your tutorials and input.

MessengerAgemo
Автор

After I finished all the code my crops no longer appear when i plant them ... help?

ForcedAbyss
Автор

By the way, does it matter if the crops are in rows, or in the columns, or is that just personal preference?

TheRealZen
Автор

Great video I'm the first whoop! !!

roque