Skip to content

ChefWist/TCreate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

TCreate - Java Game Libary (V0.45)

Introduction

I have made this game libary that you can use to easily make games with java swing. You can view TCreate info by using: TCreate.displayInfomation();

Features

  • Game Loop,
  • Scenes,
  • Diifferent Sprites,
  • Smooth Camera,
  • User Interface (UI),
  • Dragging,
  • Scaling,
  • Easy-to-use AssetManager with images & sounds,
  • Examples, and
  • Action Listeners!

Examples

There are examples to help you learn this libary:
  • Moving with WASD (movement),
  • Basic use of UI elements (homeScreen), and
  • Basic use of hovering and dragging (hoverDragging)

How to use

To use this, download the folder tCreate. Then drag it into your src folder (where you keep all your files).

Imports

  • tCreate.*
  • tCreate.assetManager.*
  • tCreate.scene.*
  • tCreate.sprite.*
  • tCreate.ui.*
  • tCreate.examples.(example).*

Using examples

To use an example such as movement, put this import at the top of your page: import tCreate.examples.movement.*;

In your main method put this line of code: MovementDemo.launch();

Documentation

Other

TCreate.displayInfomation()

Displays current version and creator in the console

ScreenPanel

Extends JPanel and holds all the code for the gameLoop and drawing and updating all elements in the scene.

ScreenObject

This is a class which you extend to have an x, y variable and a few function: update(), draw(Graphics2D graphics), getWorldX() and getWorldY(). By using the code, ScreenObject.setUp(), you can pass in a screenObject, x, y position into the brackets. There is also aDouble scale variable which you can update and then use with some functions which gives you the scaled variable. A BufferedImage image variable is also created with a function imageRender(Graphics2D g) to use images.

TCreate

new TCreate(title, width, height)

Inside the brackets, put the title of the game and then add two whole numbers for the size. This will create a JFrame with the title and size you picked for it.

TCreate.startGame()

Starts the game loop

TCreate.changeSceneTo(scene)

Changes the current scene to the one you have created yourself. To learn more about scenes, go to the section called Scenes.

TCreate.getCurrentGame()

Returns with the game which extends JPanel. Learn more about this in the section called ScreenPanel in the Other section.

TCreate.getCurrentScene()

Returns with the current scene. To learn more about scenes, go to the section called Scenes.

Camera

Camera.smoothed

True or False variable which decides if the camera should be smooth when moving.

Camera.smoothing_speed

Whole number which decides how fast the camera smoothing should be. 1 - INSTANT.

Camera.positionTo(x, y)

2 Whole numbers which snaps the camera to a positon.

Camera.moveTo(x, y)

2 Whole numbers which uses smoothing to guide the camera to the position you entered in.

Camera.getX() or Camera.getY()

Gets current x or y position of the camera.

Camera.getWorldX(x) or Camera.getWorldY(y)

Returns a number which tells you where an element should be placed on the screen as the camera moves;

About

TCreate - Java Game Libary (V0.3)

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages