-
Notifications
You must be signed in to change notification settings - Fork 0
Creating Story
THIS PAGE IS UNDER CONSTRUCTION!
You must have completed the previous steps which include installing the framework and creating the main menu.
Stories is the foundation of the novel. It is responsible for mapping and managing the scenes. Scenes are the frames within the game. You can view more about scenes here.
To create a story we need to make a new class. I will call this IntroStory
for example.
import me.piitex.renjava.api.stories.Story;
public class IntroStory extends Story {
public IntroStory(String id) {
super(id);
}
@Override
public void init() {
}
}
The 'init' function is used to add the scenes to the Story by using the addScene()
function. Note, you will be able to call this function if the class does not extends Story.
@Override
public void init() {
// As of right now there is no Nar character. This will be created later down the road.
addScene(new ImageScene("1", nar, "It's time to wake up again.", new ImageOverlay("stories/intro/introbg.png")));
}
Let's break down the ImageScene. The first parameter is the ID. Every scene needs a unique ID. The second parameter is the character. As of right now we do not have a character called nar
. You can pass null
to the character but this will make the scene not render a text-box. The third parameter is the dialogue of what the character said. If you passed null for character it is pointless to add dialogue. The last parameter is the ImageOverlay. This is used as the background image. If you wish to render a black screen you can pass null
.
Every story needs to be mapped for the engine to play them in correct order. You can map stories within your main class. For this example it would be HeroAdventure.
public class HeroAdventure extends RenJava {
...
public void createStory() {
// To map stores we need to create the objects.
new IntroStory("id"); // The ID should be changed to intro.
}
}
Under construction.