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

Feat/textures #6

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open

Feat/textures #6

wants to merge 45 commits into from

Conversation

pedromelocf
Copy link
Owner

Pull Request: Core Gameplay Features Implementation

Branch: feat/textures

Summary

This pull request introduces core gameplay features for the Cub3D project, including raycasting, texture mapping, and player movement.


Key Implementations

Raycasting

  • Implements the DDA algorithm for efficient ray-wall intersections.
  • Accurately calculates ray direction, map coordinates, and distances.
  • Determines the wall hit and its distance from the player.

Texture Mapping

  • Loads wall textures from external files.
  • Calculates the correct portion of the texture to display based on raycasting results.
  • Renders textured walls onto the screen.

Player Movement

  • Enables player movement (forward, backward, left, right) with collision detection.
  • Implements smooth player rotation.

Game Loop

  • Establishes a basic game loop that handles:
    • Player input.
    • Raycasting.
    • Rendering.

Additional Features

Basic User Interface

  • Displays the game world on the screen.
  • Handles basic key input for player movement and rotation.

Error Handling

  • Includes basic error handling for:
    • Invalid map files.
    • Other potential issues.

…idering minimap position in screen. Also creating player position structure and implementing it to t_cub3d
…ows and rotate the player direction minimap. Also inserting mlx struct and image pointer into cub struct
…ication; including drawing background function
…or was causing not print de wall in that ray. Fixed using a condition in draw_rays function to check if perpwalldist is equal to 0, and if this is true, then set that ray to print from the beggining of the screen to the end.
… loaded by mlx and use this to draw the texture. - Still not working yet and will need a lot of refactor. -Need to convert textures from dir textures to png in fact.
…ure at s_cub3d struct to load it at the beggining of exec(need improvements); also implemented function to get color to return the address of the array position of texture->pixels already converting backwards with bitwise XOR operation to use it in putpixel function later
…serting improvements like N,S,W and E textures. Still having problems with correct insertion of texturesd
…ture t_cub3d; Redifing MACROS; Changing functions prototype
pedromelocf and others added 15 commits November 22, 2024 17:15
…refactor mlx_handler.c file into more functions and fix texture implementation
…pecific jobs. Inserting all this functions into a new file called player_movements. This let the code much better and readable
…s, I removed the cast to integer inside conditions, what caused lost of precision and not allowed to check map matrix content correctly.
…x, I need to : define exactly what was the side hit(N,S,W,E); change enum to fit this; create a function to set this; then I create two functions to load the textures from end to beggin in S and W directions, and load from beggin to end in N and E directions.
@pedromelocf pedromelocf self-assigned this Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant