I'm new in coding and I usually create scripts from scraps of previously found codes and some dose of experimentation...
What was I trying to do?
- make a bar that shows weather it's night or day
What have I done?
- counting time bar
- bluish filter for backgrounds that appears during the night
- neverending display of nights and days
Code: Select all
# The script of the game goes in this file.
# Declare characters used by this game. The color argument colorizes the
# name of the character.
define e = Character("Eileen")
image night = "night.png"
image bg plain = "bg plain.png"
image sun = "sun.png"
image moon = "moon.png"
init:
$ timer_range = 0
$ timer_jump = 0
# The game starts here.
label start:
transform alpha_dissolve:
alpha 0.0
linear 0.5 alpha 1.0
on hide:
linear 0.5 alpha 0
# This is to fade the bar in and out, and is only required once in your script
screen countdown:
timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)])
bar value time range timer_range xalign 0.5 yalign 0.06 left_bar "#FFE4C4" right_bar "#4169E1" xmaximum 600 at alpha_dissolve # This is the timer bar.
# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.
screen countdown2:
timer 0.01 repeat True action If(time > 0, true=SetVariable('time', time - 0.01), false=[Hide('countdown'), Jump(timer_jump)])
bar value time range timer_range xalign 0.5 yalign 0.06 left_bar "#4169E1" right_bar "#FFE4C4" xmaximum 600 at alpha_dissolve
# This is the timer bar.
# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.
# time = the time the timer takes to count down to 0.
# timer_range = a number matching time (bar only)
# timer_jump = the label to jump to when time runs out
scene bg plain
label day_slow:
$ time = 5
$ timer_range = 5
$ timer_jump = 'night_slow'
show screen countdown
show sun at top
hide moon
hide night
with dissolve
$ renpy.pause (10.0, hard=True)
jump day_slow
label night_slow:
$ time = 5
$ timer_range = 5
$ timer_jump = 'day_slow'
show screen countdown2
show moon at top
show night
with dissolve
hide sun
$ renpy.pause (10.0, hard=True)
jump night_slow
show eileen happy
e "You've created a new Ren'Py game."
e "Once you add a story, pictures, and music, you can release it to the world!"
# This ends the game.
return
- to know how to change the code in a way that it won't affect the gameplay - something working in the background
Thank you for any help.