redirected from Handy Skript (1.11.1 - 1.13)
ArcadeBoard API - Game
The Game class is found in be.maximvdw.arcadeboard.api.game.Game
- The game author must have tested the game for scoreboard usage
- The game should somehow tell the player on how to use the game (instructions)
- The game should provide a menu to pause or stop the game (helper methods provided in ArcadeBoard API)
Extending the game class(top)The first step is to extend the game class. This will force you to implement a constructor and implement the "game loop" and game events (start/stop).
Each game requires a type parameter to define the Canvas you are drawing on. While the API is Scoreboard centered, it can be scaled for future expansion.
Annotating your extended class(top)The next step is to provide some information for your game. This is done by annotations that are read by the plugin when the game is loaded into memory.
The required information:
- GameName (be.maximvdw.arcadeboard.api.annotations.GameName)
A name for your game following the requirements of [aA-zZ] (only letters)
- GameAuthor (be.maximvdw.arcadeboard.api.annotations.GameAuthor)
- GameVersion (be.maximvdw.arcadeboard.api.annotations.GameVersion)
- GameDescription (be.maximvdw.arcadeboard.api.annotations.GameDescription)
- GameDisplayName (be.maximvdw.arcadeboard.api.annoations.GameDisplayName)
A fancier name than the GameName (can contain numbers and spaces, ..)
- GameControls (be.maximvdw.arcadeboard.api.annotations.GameControls)
Description of your controls
- GameScreenshots (be.maximvdw.arcadeboard.api.annotations.GameScreenshots)
A string array of links to screenshots of your game
- GamePermalink (be.maximvdw.arcadeboard.api.annotations.GamePermalink)
A link to an information page of your game
- GameVideos (be.maximvdw.arcadeboard.api.annotations.GameVideos)
A string array of links to videos of your game
- GameConstraint (be.maximvdw.arcadeboard.api.annotations.GameConstraint)
A constraint given to your game. The game will not start when this constraint is not met. Examples would be a server version, ArcadeBoard version (when you use new features), ...
- GameConstraints (be.maximvdw.arcadeboard.api.annotations.GameConstraints)
A list of multiple constraints
Changing the game settings(top)The game has some default settings. However you will most likely want to change these. Settings range from things like the minimum amount of players to things like aimed FPS and resource pack requirements.
Game events(top)A class extending a Game will have to implement all the game events. External plugins can just use the Bukkit events to catch these events.
Starting a game(top)
- When a player wants to start a single player game, the Game is constructed and directly afterwards the GameStartEvent (onGameStart method) is fired.
- When a player wants to start a multi player game, the Game is constructed but the players are put in a lobby (GameLobby). When the game starts (by reaching a minimum amount of players or when all players are ready) the GameStartEvent (onGameStart method) is fired.
Stopping a game(top)
- A game is stopped when there aren't enough players. The GameEndEvent (onGameEnd method) is fired.
- A game is stopped when the "stop()" method is called. The GameEndEvent (onGameEnd method) is fired.
- The GamePlayerLeaveEvent (onPlayerLeave method) is fired when a player leaves. This event is triggered before the GameEndEvent in case the player causes to trigger the minimum amount of players
Game loop(top)Once you have the game settings ready, it is time to program inside the game loop. Continue on this wiki for information on how to draw on the Canvas of a player.