skylarbpayne / cespong Goto Github PK
View Code? Open in Web Editor NEWA version of Pong using my Component Entity System
License: Apache License 2.0
A version of Pong using my Component Entity System
License: Apache License 2.0
The Scoring System should track a max score. When the max score is reached, ScoringSystem should transition to the Win Scene. Pressing Escape should lead back to the main menu.
Add a splash screen that slowly fades out until starting the game. Later it should transition into the main menu.
As of now, the AI motion is very fidgety. Need to write a better AI function to smooth the AI motion towards the ball. Essential use an algorithm like:
disY = ballY - paddleY
velY = disY * easingConstant;
if(velY > 5) velY = 5
if(velY < -5) velY = -5
This will allow the paddle to slow down as it reaches the ball height while not allowing it to surpass a certain speed.
Also, add in an accumulator to make sure AI does not update every single frame. Update AI perhaps a few times per second.
The main menu should include options for:
Play (1 Player)
Play (2 Player)
Controls
This will also mean that a button system will have to be put in place. Later this button system should be abstracted away into CES.
The Controls scene should display what keys should be used to control each player, as well as what keys can be used to return to the main menu.
The collision system, or some other sort of system needs to ensure that objects stay within the game window. This is quite a game specific system (as objects in other games may go outside the window), so I will need to think of an elegant way to allow custom behavior in terms of game objects and the window.
For now, it will suffice (and may also suffice as a permanent solution) to create another system that takes objects with colliders and ensures that that are within the window by sending a move entity message to move the entity back into the window and perhaps also a push entity message to reset speed to 0. Although, I'll have to test for the push entity message. It will probably not be necessary.
Add a Scoring System with scoring components. There should be two scoring entities which define each player's score. The ScoringSystem should make note of the ball and check when the ball passes out either side of the window. If it passes out left, update player 2s score, if it passes through the right, update player 1s score. This should also keep track of a max score and consequently end the game when either player reaches the max score.
1-P should instantiate with an AI player while 2-P should instantiate with 2 human players.
Based on how the collision system works, if paddle is moving the instant that the ball collides with it, the paddle will be pushed back. An easy fix for this is to ensure that the ball is created first. However, this may not be ideal for other types of games. I will ensure that the ball is created first while thinking of other solutions for later games.
First step: Make a PointScoredMessage. Obviously, when a point is scored, emit that message.
the main game scene should inherit from a PointScoredMessage listener and on that message type, it should reset the game and then set a pause boolean.
While looping through, check the pause boolean. If the pause boolean is true, pause for a small amount of time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.