Skip to content

xnafan/RPS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RPS

A Rock-Paper-Scissors simulation. The icons move around and the loser in every collision is changed to the winner's type. You can toggle between random or hunt/flee behavior.

image

Interesting elements

Game partitioning helper class

The GamePartitioningHelper class splits the game area into sub-segments. At the beginning of every update the game objects are put into lists depending on which rectangles they overlap. This makes it faster to find collision candidates.

Game object movement

The GameObject stores a direction (in radian) for movement, every update that direction is moved a little bit randomly clockwise or counterclockwise. For every update the GameObject's new location is calculated, and if crosses the outside border of the game area a new direction is found, until a valid move can be performed.

Keyboard overview

F5 : Restart game
F11 : Toggle fullscreen
'+' : Add 100 game objects and restart
'-' : Remove 100 game objects and restart
'I' : toggle intelligent behavior (hunt/flee)

About

A simple Rock-Paper-Scissors simulation with collision leading to a winner.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages