hiulit / godot-3-2d-day-night-cycle Goto Github PK
View Code? Open in Web Editor NEWA 2D โ๏ธ Day / ๐ Night cycle using CanvasModulate and a moon light effect using Light2D.
License: MIT License
A 2D โ๏ธ Day / ๐ Night cycle using CanvasModulate and a moon light effect using Light2D.
License: MIT License
day_duration
is initially set to minutes:
then it's converted to seconds:
but there are only 60 seconds in a minute, so why does it multiply the result by 60 again?
I ask because I'm currently looking into an issue with my game and to fix it I need to understand this code.
version 4.2.1
@onready var color_transition_tween = $ColorTransitionTween
@onready var color_transition_tween = create_tweener()
#self doesn't work
@onready var color_transition_tween = get_tree().create_tweener()
#Node2D doesn't work
@onready var color_transition_tween = get_parent().create_tweener()
#same target as before in most cases
I think it should be:
@onready var color_transition_tween = get_tree().create_tween()
func _ready():
color_transition_tween.set_trans(Tween.TRANS_SINE)
color_transition_tween.set_ease(Tween.EASE_OUT)
But this raises the following errors:
"Tween started with no tweeners" and,
"Tween invalid. Either finished or created outside scene tree"
and the transition looks as follows:
color_transition_tween.tween_property(self, "color", color_night, GlobalTime.state_transition_duration)
await color_transition_tween.finished
Hey there - was playing with your project and noticed that in the main timer you overwrite seconds_elapsed_remainder each time _physics_process gets called, so fractions of a second are potentially getting lost every cycle. Change to "seconds_elapsed_remainder += delta * IN_GAME_SECONDS_PER_REAL_TIME_SECONDS" fixes this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.