Preston Chapman Profile Picture

Preston Chapman

University of Advancing Technology Logo

Projects

RPG Simulator

Application

GUI

This project is a standard Role Playing Game (RPG) simulator. The user will be able to choose their name, color, and difficulty, then they will fight a variety of enemies. The more waves you complete the higher your score will be. All scores are added to a local database, allowing you to see your ranking.

This project uses SQLite 3 to store the high-score data. This allows for a large amount of data to be stored, and quickly retrieved by using a local SQL based Database.

Object Oriented Programming (OOP) principles were used throughout this project, ranging from Abstract Character classes, interfaces for formatting and gradients, and custom Panels and Frames from Java Swing.

Register Screen

The user is able to register an account to save their progress to the SQL Database, the use can choose a name, difficulty, and color

Objective: Implement data-driven solutions.

This project uses SQLite 3 as a database to store data. This results in the application showing different information based on previous attempts from other users. By changing the SQLite to be a server based SQL server, the leaderboard can be public, with entries shared between devices.

Get User Placement

public int getUserPlacement(int ID){ try { String select = "SELECT id, score FROM users ORDER by score DESC"; ResultSet resultSet = statement.executeQuery(select); int placement = 1; int prevScore = 0; while (resultSet.next()){ int id = resultSet.getInt("id"); int newScore = resultSet.getInt("score"); if(newScore < prevScore) placement++; if(id == ID){ return placement; } prevScore = newScore; } return -1; } catch (SQLException e) { System.err.println(e); return -1; } }

SQLManager.java 90-110