Skip to content

Portals and Worlds Code

katherinegray97 edited this page Sep 24, 2017 · 16 revisions

Creating a portal

All portals are an instance of the Abstract portal class. Portals are created by calling, for example

GameManager.get().getWorld().addEntity(new AbstractPortal(14, 17, 0, "Desert World"));

where the arguments of the method are for int: posx, int: posy, int: posz, String: texture.

The base portal extends this class as its functionality also includes being mortal (i.e. it can take damage) and having a health bar displayed as a progress bar. To instantiate a base portal, therefore you need to call:

GameManager.get().getWorld().addEntity(new BasePortal(14, 17, 0, 100));

where the arguments of the method are for int: posx, int: posy, int: posz, int: maxHealth. (Note that the texture for the base portal does not need to be specified)

Transporting to a new world

The plater can be transported to a new world by calling GameManager.get().getWorld().removeEntity(player); GameManager.get().getManager(WorldManager.class).setWorld(world); GameManager.get().getWorld().addEntity(player);

UML Class diagram

See below for a UML diagram of these classes: portal class diagram


Gameplay

Design

Asset Creation

User Testing

Code Guidelines


http://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gif

Clone this wiki locally