View Source DevJoy
A package to simplify creation of Visual Novel games.
Installation
def deps do
[
{:dev_joy, "~> 1.0"}
]
end
- Create a new
phoenix
orscenic
project or just use existing one - Add
dev_joy
to your dependencies - Add English content using DSL
- Add assets to your game
- Fetch your first scene
- Draw your game following output of
current_scene_module.get_part()
orcurrent_scene_module.get_part(part_name)
- Optionally translate content using gettext (call
mix gettext.extract
).
Except drawing you only have to provide a content to the game. To "draw" your game all you need to do is to convert structs into phoenix
templates or scenic
graphs and style them respectively.
Example scenes
Main menu
defmodule MyApp.Scenes.Main do
use DevJoy.Scene
alias MyApp.Scenes.FirstStage
alias MyApp.Scenes.SecondStage
alias MyApp.Scenes.ThirdStage
part :main do
menu "Welcome in MyApp!" do
asset "/assets/main/background1.jpg", size: :stretch_to_fit, type: :backgound
asset "/assets/main/background1.mp3", loop: true, type: :background
choice "First stage", goto(FirstStage, :main)
choice "Second stage", goto(SecondStage, :main)
choice "Third stage", goto(ThirdStage, :main)
choice "Settings", goto(:settings)
choice "Credits", goto(:credits)
end
end
part :credits do
dialog :admin, "Assets: me (spend lots of time on search for free image and sounds)"
dialog :admin, "Scenario: me (generated it by AI)"
dialog :admin, "Translations: me (I'm just young kid, so nobody would notice that I have used some random free translator)"
dialog :admin, "Game fun: … (on TODO list already!)"
dialog :admin, "Aren't I the best? >^·^<"
goto()
end
part :settings do
dialog :admin, "Still working on it …"
dialog :admin, "Are you stil here ?!?!"
dialog :admin, "Oh, please! There are no achievements in this game!"
dialog :admin, "Seriously …"
dialog :admin, "Oh, right! I haven't instructed the game to navigate you back to main menu!"
goto()
end
end
Your game's first stage
defmodule MyApp.Scenes.FirstStage do
use DevJoy.Scene
alias MyApp.Scenes.Main
alias MyApp.Scenes.SecondStage
part :main do
asset "/assets/first-stage/background1.jpg", size: :stretch_to_fit, type: :backgound
asset "/assets/first-stage/background1.mp3", loop: false, type: :foreground
dialog :admin, "Lorem ipsum …"
challenge :input_next_words, count: 3, for: "Lorem ipsum"
asset "/assets/first-stage/admin-bored.jpg", duration: "0.5s", type: :preview
question :admin, "Aren't you tired already?" do
choice "Yes! I'm done!", goto(Main, :main)
choice "Why? Isn't that just a start?", goto(SecondStage, :main)
end
end
end