• Docs
  • Install
  • Follow @cosplayengine
  • v.0.8.10
  • GitHub
  • Watch
  • Examples
  1. Home
  2. Examples

Examples

  • Introduction
  • Install
  • ASCII Games
  • Demos
  • Examples
  • Macarena
  • Pong
  • Snake
  • Bird
  • Developer Guide
  • Quick Game 🏃
  • Key Concepts
  • Game Structure
  • Scenes & Objects
  • Log & Debugging
  • Pixels & Colors
  • Images
  • Keyboard Input
  • Sprite Animation
  • Shaders
  • Particle Effects
  • Fonts
  • Canvas Drawing
  • Text Input
  • Camera Tracking
  • Tile Mapping
  • Audio
  • Video
  • Build & Run

Built-In Games

CosPlay comes with a number of built-in ready to play games:

  • Pong
  • Snake
  • Bird
  • Macarena

Examples

CosPlay also comes with many examples for each functional area. The source code for these examples is shipped with the project (see org.cosplay.examples package) and can be also found on GitHub.

If you have CosPlay project in IDE you can review the source code and run each example right from IDE. Each example is a simple Scala application with the main(...) method. The easiest way to run examples from the command line is to use SBT or Maven. First, clone and build the CosPlay Git repository (this needs to be done only once):

                    # One-time Git clone & build:
                    $ git clone https://github.com/nivanov/cosplay.git
                    $ cd cosplay
                    $ sbt package
                

Assuming you are in cosplay folder use the following table to run examples:

ExampleRun & Code

Built-In Terminal Emulator

By default, all examples start in the system terminal. If you want to run these examples in the built-in terminal emulator you need to add emuterm as a program argument. Depending on how you start the example - SBT, Maven, IDE or straight command line - this is done differently. For example, to run video example using built-in terminal emulation:

                        $ sbt "project cosplay; runMain org.cosplay.examples.video.CPVideoExample emuterm"
                    
  • On This Page
  • Examples
  • Quick Links
  • Discord
  • Stack Overflow
  • GitHub
  • @cosplayengine
  • YouTube
  • API
Copyright © 2023 Rowan Games, Inc. Privacy • Docs release: 0.8.10 Latest: