renpy
Преимущественно выдержки из документации. Причём неведомой давности, потому что перенесено из моей энциклопедии всего.
Аудио
Ren'Py supports playing music and sound effects in the background, using the following audio file formats
- OGG Vorbis
- MP3
- WAV (uncompressed PCM only)
Ren'Py supports an arbitrary number of audio channels. Three are defined by default:
- music - A channel for music playback.
- sound - A channel for sound effects.
- voice - A channel for voice.
New channels can be registered with renpy.music.register_channel()
.
The 'Music Volume', 'Sound Volume', and 'Voice Volume' settings of the in-game preferences menu are used to set individual volumes for these channels.
Sounds can also be set to play when buttons, menu choices, or imagemaps enter their hovered or activated states. See Button Style Properties. Two configuration variables, config.main_menu_music
and config.game_menu_music
allow for the given music files to be played as the main and game menu music, respectively.
Play
The play statement is used to play sound and music. If a file is currently playing, it is interrupted and replaced with the new file.
The name of a channel is expected following keyword play, (Usually, this is either "sound", "music", or "voice"). This is followed by audiofile(s), where audiofile(s) can be one file or list of files. When the list is given, the item of it is played in order.
The fadein and fadeout clauses are optional. Fadeout gives the fadeout time for currently playing music, in seconds, while fadein gives the time it takes to fade in the new music. If fadeout is not given, config.fade_music
is used.
The loop and noloop clauses are also optional. The loop clause causes the music to loop, while noloop causes it to play only once. If both of them isn't given, the default of the channel is used.
play music "mozart.ogg" play sound "woof.mp3" play myChannel "punch.wav" # 'myChannel' needs to be defined with renpy.music.register_channel(). "We can also play a list of sounds, or music." play music [ "a.ogg", "b.ogg" ] fadeout 1.0 fadein 1.0
Stop
The stop statement begin with keyword stop, followed by the the name of a channel to stop sound on. It may optionally have a fadeout clause.
stop sound stop music fadeout 1.0
Queue
The queue statement is used to queue up audio files. They will be played when the channel finishes playing the currently playing file.
The queue statement begin with keyword queue, followed by the the name of a channel to play sound on. It optionally takes the loop and noloop clauses.
queue sound "woof.ogg" queue music [ "a.ogg", "b.ogg" ]
Основа таймера
def countdown(st, at, length=0.0): remaining = length - st if remaining > 5.0: return Text("%.1f" % remaining, color="#fff", size=72), .1 elif remaining > 0.0: return Text("%.1f" % remaining, color="#f00", size=72), .1 else: renpy.jump('finished') return anim.Blink(Text("0.0", color="#f00", size=72)), None
http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=9376&p=122741&hilit=timeout#p122741 - про таймер и редактирование кода. http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=6972&hilit=countdown
Видео
Ren'Py is capable of using libav (included) to play movies using the video codecs:
Theora V8 MPEG 4 part 2 (including Xvid and DivX) MPEG 2 MPEG 1
and the following audio codecs:
Vorbis MP3 MP2 PCM
inside the following container formats:
Matroska WebM Ogg Avi Various kinds of MPEG stream.
(Note that using some of these formats may require patent licenses. When in doubt, and especially for commercial games, we recommend using Theora, Vorbis, and Matroska or Ogg.)
Ren'Py expects that every movie will have an audio track associated with it, even if that audio track consists of nothing but silence. This is because the audio track is used for synchronization purposes.
Movies can be displayed fullscreen, or in a displayable. Fullscreen movies are the more efficient.
Displayable movie
A movie can also be displayed inside a displayable, allowing it to be combined with other things on the screen. To do this, one must first show a Movie displayable, and then play the movie on an audio channel. (We recommend using the movie channel for this purpose.)
init: image movie = Movie(size=(400, 300), xalign=0.5, yalign=0.5) label movie_sign: scene black show movie play movie "incubus.mkv" "Wow, this movie is really terrible." "I mean, it stars William Shatner..." "... speaking Esperanto." "MAKE IT STOP!" stop movie hide movie "Thats... better."
Fullscreen
Fullscreen Movies
The easiest way to display a movie fullscreen is to display it using the renpy.movie_cutscene()
function. This function displays a movie for a specified length of time. When that time has elapsed, or when the user clicks to dismiss the movie, the movie ends and the function returns.
$ renpy.movie_cutscene("On_Your_Mark.mpg")
renpy.movie_cutscene(filename, delay=None, loops=0, stop_music=True)
This displays an MPEG-1 cutscene for the specified number of seconds. The user can click to interrupt the cutscene. Overlays and Underlays are disabled for the duration of the cutscene.
filename The name of a file containing an MPEG-1 movie. delay The number of seconds to wait before ending the cutscene. Normally the length of the movie, in seconds. If None, then the delay is computed from the number of loops (that is, loops + 1) * the length of the movie. If -1, we wait until the user clicks. loops The number of extra loops to show, -1 to loop forever.
Returns True if the movie was terminated by the user, or False if the given delay elapsed uninterrupted.
Неведомо когда списанное
When you wish to distribute your game to a wider audience than just hentai fans, why not make hentai optional? Using the following code, a "Hentai" option is added to the preferences. It defaults to False, so that your game would be teen-safe from the start.
init python: # Set the default value. if persistent.hentai is None: persistent.hentai = False # Add the pref. config.preferences['prefs_left'].append( _Preference( "Hentai", "hentai", [ ("Enabled", True, "True"), ("Disabled", False, "True") ], base=persistent))
Then when it comes time for a hentai scene:
if persistent.hentai: # Let's get it on. else: # Holding hands is more than enough.
%
How to add ambient noises to your game for greater immersion
\label{sec:renpyambient}
Quite simple, really. With a function that generates a playlist of ambient noises mixed with periods of silence. Requires a 5 second silent ogg as well.
# This goes in init block python: def ambient(songlist, interval): playlist = ["sounds/pause_5s.ogg"] for song in songlist: playlist.append(song) j = renpy.random.randint(2, interval) for i in range(0, j): playlist.append("sounds/pause_5s.ogg") return renpy.music.play(playlist, channel=6) # This is used a the beginning of label, as the most logical place for ambient noises to begin.. :P ambient(("sounds/ambient02.ogg","sounds/ambient06.ogg","sounds/ambient09.ogg"), 4)
Lip Flap
Sometimes, you want to synchronize a character's lip movements to her dialogue. That's what Lip Flap is for.
First, download lip\_flap.rpy, and add it to your game directory. This file contains the definition of the LipFlap function. This function returns an object that can be used in a show statement to produce lip flap.
Function: LipFlap (prefix, default="", suffix=".png", combine=…):
- prefix - The prefix of filenames that are used to produce lip flap.
- default - The default lip that is used when no parameters is given.
- suffix - A suffix that is used.
- combine - A function that combines its three arguments (prefix, lip, and suffix) into a displayable. The default combine function is Image(prefix + lip + suffix). This could be changed if you want to, say LiveComposite the lips onto a larger character image.
To use lip flap, first declare an image using LipFlap. Then show that image with a parameter string consisting of alternating lips and delays. It will show the first lip, wait the first delay, show the second lip, wait the second delay, and so on. If the string ends with a lip, it will display that lip forever. If it ends in a delay, it will repeat after that delay has elapsed.
See Blink And Lip Flap for an example of combining this with character blinking. Example
# Note that Ayaki_ShyA.png, Ayaki_ShyB.png, and Ayaki_ShyC.png all exist in the # game directory. init: image ayaki shy = LipFlap("Ayaki_Shy", "A", ".png") label ayaki: scene bg whitehouse # Show Ayaki with her default lip, A. show ayaki shy "..." # Show Ayaki with varying lips. show ayaki shy "A .15 B .20 C .15 A .15 C .15 A" "Ayaki" "Whatsoever, things are true." return
Ссылки
- http://lemmasoft.renai.us/forums/
- http://renpyhandbook.tumblr.com/code-tutorials
- http://anivisual.net/blog/2014-09-28-63 - создание первой страницы игры с imagemap
- Quickstart — Ren'Py Documentation http://www.renpy.org/doc/html/quickstart.html
- Lemma Soft Forums • View forum - Ren'Py Cookbook http://lemmasoft.renai.us/forums/viewforum.php?f=51
- The Ren'Py Handbook http://renpyhandbook.tumblr.com/code-tutorials
- http://renpy.org/ - главсайт. RenPy умеет ссылки и другие теги.
- Ren'Py Games List : Search for russian http://games.renpy.org/search?q=russian
- Ren'Py (RenPy; РенПи) — Прохождения, Обзоры, Видео, Скриншоты —- Игры Gamer.ru: социальная сеть для геймеров http://www.gamer.ru/ren-py/