Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game Setup, Player Movement, Shooting, and Bullet Management #98

Open
Shivg2901 opened this issue Jan 8, 2025 · 3 comments
Open

Game Setup, Player Movement, Shooting, and Bullet Management #98

Shivg2901 opened this issue Jan 8, 2025 · 3 comments
Assignees
Labels

Comments

@Shivg2901
Copy link
Member

Description

Set up the basic structure of the game with a player-controlled car that can move within the terminal using the up and down (or left and right) arrow keys or WASD. The car should shoot bullets upwards (or in a direction aligned with the movement), and bullets should move across the screen, disappearing after leaving the view. This issue will also involve managing bullets, including creation, movement, and removal.


Tasks

Install Required Libraries

  • Install and configure necessary libraries like blessed (for terminal window handling) and keyboard (for capturing user input).
  • Configure the game to run in a terminal-based CLI environment with smooth visuals.

Create the Game Window

  • Use the blessed library to create a terminal window.
  • Set the window dimensions and display the initial game screen (with an empty background or a simple border).
  • Ensure proper screen resizing and smooth rendering to avoid glitches.

Render the Player (Car)

  • Define a player object (car) using a simple character or symbol (e.g., #, @).
  • Position the car in the center of the screen initially.
  • Ensure the car's position can be updated based on player input.

Implement Player Movement

  • Capture player input for movement using the arrow keys or WASD (up, down, left, right).
  • Ensure the car's movement is constrained within the terminal screen boundaries:
    • Vertical Movement: Up/Down.
    • Horizontal Movement: Left/Right.
  • Smooth transitions between movements with a frame update.

Implement Shooting Mechanic

  • Add a mechanic that lets the player shoot bullets using the Spacebar or assume the car shoots bullets continously whatever feels appropriate.
  • Represent bullets using a character (e.g., * or |).
  • Position bullets slightly above (or ahead) of the player car when fired, depending on the movement type.

Bullet Movement

  • Ensure bullets move upwards (or horizontally) when fired.
  • Update the bullet's position on the screen at regular intervals.
  • Handle the movement smoothly, ensuring bullets travel across the screen, respecting the boundaries of the game window.

Bullet Removal

  • Detect when bullets go off the screen or exit the view and remove them.
  • Optionally, remove bullets from memory or mark them for removal to avoid resource drain.

Game Update and Rendering

  • Continuously refresh the terminal screen to reflect:
    • The player's car position.
    • Bullet positions and movement.
  • Avoid flickering or performance issues by managing screen updates efficiently.

User Input Handling

  • Ensure the game can handle user input without delay, allowing smooth interaction.
  • Implement a key event loop for continuous input capture (e.g., WASD for movement, Spacebar for shooting).

Acceptance Criteria

  • The terminal window is successfully created, and the player’s car is rendered appropriately on the screen.
  • The player can move the car up, down (or left, right) using the arrow keys or WASD, with movement constrained within the terminal window.
  • The player can shoot bullets upwards (or horizontally) with bullets appearing at the correct position relative to the car.
  • Bullets move across the screen and are automatically removed when they go off-screen or leave the visible terminal area.
  • The game window continuously updates the screen to reflect the current state of the car and bullets.
  • The user input is captured smoothly and without delay, providing a responsive gameplay experience.

Deliverables

  • A fully functional CLI game window where the car can move based on user input (either up and down or left and right).
  • A working bullet mechanic that allows the car to shoot upwards (or horizontally), with bullets moving across the screen and disappearing when they exit.
  • Continuous updates to the game screen to reflect the current state (player movement, bullet positions).
  • Smooth user input handling for movement and shooting without performance issues.

Notes

  • Player Movement: The car should only move within the terminal's screen boundaries. If the player tries to move beyond the screen edges, the car should not move further.
  • Bullet Mechanics: Bullet movement should be smooth, and bullets should be removed from the screen once they travel beyond the window. Consider implementing a method to handle the removal efficiently to avoid memory bloat.
  • Game Loop: The game should run in a continuous loop where the player's input and screen updates happen without delays.

Additional Suggestions

  • You could add a frame rate limit to smoothen the movement of both the player and the bullets, ensuring consistent gameplay across different terminal environments.
@Darkknight0125
Copy link
Contributor

/claim

@Shivg2901
Copy link
Member Author

/info

@Opencodeiiita-Bot
Copy link

User Repo
Darkknight0125 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants