Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

jayjonesvip/golf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Golf Game

This is a simple golf game implemented using HTML, CSS, and JavaScript. The game consists of a hole and a ball, and the objective is to hit the ball into the hole with as few strokes as possible.

Game Mechanics

  • The game starts with the user selecting the power level of the shot - light, average, or strong.
  • The distance the ball can travel is then calculated based on the power level, and a random distance within a range is selected.
  • The ball is then launched and moves towards the hole at a steady pace, with the user able to adjust the direction of the shot using the left and right arrow keys.
  • The ball's size changes dynamically based on its position relative to the hole.
  • Once the ball reaches the hole, the user is shown the number of strokes taken, and given the option to play again.

Code Structure

  • The game is implemented using several functions in JavaScript, which are called from the main game loop.
  • HTML and CSS are used to structure and style the game interface, including the hole and ball elements.
  • User inputs are handled using event listeners, which are triggered when the user presses a key or clicks a button.

Possible Improvements

  • The game could be made more challenging by adding obstacles or hazards to the course.
  • Multiplayer functionality could be added to allow players to compete against each other.
  • Sound effects and animations could be added to enhance the user experience.
  • A scoring system could be implemented to allow players to keep track of their progress over time.

Technologies Used

  • HTML
  • CSS
  • JavaScript

About

pure html and js golf swing simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors