Commit Graph

275 Commits (a8e0d99870260d83e08e9865d48e04703a3c8fa5)
 

Author SHA1 Message Date
En Yi 99112e3a7c Add better handling for complete AABB overlap 2023-06-05 20:05:20 +08:00
En Yi 023536f7c0 Update collision system
Changelog:
- Update collision functions to omit entity_manager
    - Change tile entity set to use map 64v to store entity pointer
- For complete overlap, return the smaller magnitude
    - Still incorrect though
- Add a check for empty space before moving the entity during collision
  check
2023-06-05 17:40:56 +08:00
En Yi aae8811cc1 Add movement to boulder for grid movement 2023-06-05 15:11:06 +08:00
En Yi c84ef5d5ee Update moveable movement system
Changelog:
- Before entering grid movement, check if any solid entities exist.
    - This allow rolling over the player, who is not solid
2023-06-05 13:40:19 +08:00
En Yi 8bc14b17b1 Add boulder-boulder interaction when landing
Changelog:
- Add previous velocity in ctransform component
- Add functions to check if a boulder can move left or right when
  landing on a boulder
- Adjust system execution order
2023-06-04 23:51:02 +08:00
En Yi 0d58ffd79a Tweak tile collision function logic
Changelog:
- Remove check for same tag, seems to be the cause for unaligned crates
- Remove dead code: collision event collection
    - Will rethink this if necessary
2023-06-04 14:54:53 +08:00
En Yi 0e94e64a6a Add solid entity check to boulder movement
Changelog:
- Prevent Boulder going into grid movement if there is an entity in
  the movement when pushed
2023-06-04 14:28:08 +08:00
En Yi 20ec3f6395 Improve on the boulder pushing mechan
Changelog:
- Implement point to AABB check function
- Change moveable check to use point-AABB check
- Allow boulder pushing from standing still
2023-06-03 14:01:10 +08:00
En Yi 62dc51d45e Implement simple systems for pushing boulder 2023-05-30 21:32:04 +08:00
En Yi b5f026c96b Refactor Entity Tag out of EC
Tags are game-specific things. So, move out of EC
2023-05-29 21:41:17 +08:00
En Yi 29c9b4eec7 Add boulder entity and moveable component 2023-05-29 21:36:06 +08:00
En Yi a4c9a0d97c Add README 2023-05-28 15:18:03 +08:00
En Yi 7a74836656 Update gitignore
Include the res directory
2023-05-28 14:58:10 +08:00
En Yi 0b9637a2db Add RAYLIB_DIR as CMake Cache variable 2023-05-28 14:45:10 +08:00
En Yi 332fe33e8e Prevent crashing when no sprites is supplied 2023-05-27 17:01:20 +08:00
En Yi 542c7cf57c Add crouch sprite transition 2023-05-27 16:39:17 +08:00
En Yi 937f63b0ca Add pause feature on sprite animation
Ladder animation now pauses on no movement
2023-05-24 21:54:59 +08:00
En Yi c0aa37886f Add Player Ladder, Crouch, and Swim transitions 2023-05-24 21:34:50 +08:00
En Yi 9c2e21f4d2 Add jumping and falling player sprites 2023-05-23 21:42:01 +08:00
En Yi b1a6430eb7 Add horizontal flip to sprites 2023-05-23 21:33:05 +08:00
En Yi d2de5cfed9 Update gitignore 2023-05-23 21:18:17 +08:00
En Yi 237bee41a9 Add simple player transition logic Stand<->Run 2023-05-23 21:17:36 +08:00
En Yi bc7f9ef777 Add manager field to an entity
Since an entity is essentially tied to a manager, put it as a field in
Entity. This means no need to pass entity manager when getting a
component, which is more intuitive.
2023-05-23 21:00:23 +08:00
En Yi 4478a512a3 Combine Component, Entity + Manager headers
It has reached a point where it is much easier to combine these three
than to separate them.
2023-05-23 20:37:55 +08:00
En Yi e1a7774bfb Replace component data struct to use array
This will use more memory from the get go. I just prefer to statically
allocate memory.
2023-05-22 21:00:50 +08:00
En Yi b0e1d33ad6 Implement player sprite info loading from file 2023-05-22 20:33:48 +08:00
En Yi 98450d0bba Rework Entity Sprite Component & Add Tile Sprite
Changelog:
- Add tile sprites as part of Level Data
- Render tile sprite if loaded in
- CSprite now stores array of sprite rendering info
    - use current idx to keep track
2023-05-20 18:23:26 +08:00
En Yi 0f485d89f2 Add assets loading from a file
Changelog:
- Add assets_loader functions from a file
- Update scene_test to use loader function
2023-05-20 16:14:39 +08:00
En Yi 57c9eb0216 Fix incorrect usage of s64 map
Changelog:
- Turns out, the map doesnt make a copy of the string for storage.
  Therefore, need to store the name somewhere before inserting into
  the map.
- Add struct for each assets to retain the name.
- Update assets functions to maintain interface
2023-05-20 16:09:00 +08:00
En Yi e9d9ffff20 Refactor implementation of Crate Entity 2023-05-16 22:14:54 +08:00
En Yi 3580209f71 Refactor out implementation of Player Entity 2023-05-16 21:55:59 +08:00
En Yi 7b3685b792 Refactor for better separation of concern
Changelog:
- Separate out engine-specific stuff vs game-specific stuff
2023-05-16 21:09:38 +08:00
En Yi ee4313adbb Add a sprite for player 2023-05-15 20:48:56 +08:00
En Yi bafb32501f Replace mempools free list data struct
Changelog:
- Use circular buffer instead of sc_queue
    - The size is already known beforehand. So circular buffer seems
      to be more appropriate
2023-05-13 15:14:05 +08:00
En Yi 64c3532305 Replace method to get Scene specific data
Changelog:
- Use CONTAINER_OF macros to get scene specific data
- Remove unnecessary scene_data from Scene_t
- Still use pointer to scene specific data as these data could be
  quite heavy on memory
2023-05-07 21:04:24 +08:00
En Yi 49b5a19cad Fix Out of buffer access in tilemap
Others:
- Change HUD BG colour to lightgray
- Use CONTAINER_OF macros to access specific scene data in editor scene
2023-05-07 19:29:35 +08:00
En Yi cd71dae730 Add camera and game viewport
Changelog:
- Add 2D camera to level scene
- Add camera update system to level systems
- Add viewport to draw the level
    - This allows larger level to fit inside the window
- Update mouse handling to account for camera and viewport
2023-05-07 19:15:15 +08:00
En Yi 7c94ecde89 Fix main program crash
Changelog:
- Init asset management and pass into scene inits
2023-05-07 16:27:14 +08:00
En Yi d4dfe01182 Slightly rework scene rendering
Changelog:
- Draw calls are now in rendering function of a scene
    - This is to allow flexibility on how a scene is rendered
- Modify level scene to render level using RenderTexture
    - This is to prepare for camera implementation later
- CloseWindow is called after all de-init functions is called
2023-05-07 16:25:03 +08:00
En Yi 9eb46d0e57 Implement ladder mechanics
Changelog:
- Change ladder to be in player state component
- Add ladder state transition
    - Hold up or down to enter ladder when overlap with ladder
    - On ground, ladder has to be on foot
    - Either jump or exit a ladder to exit ladder state
- Ignore external forces during ladder state
    - Ladder uses velocity instead of acceleration to move player
- Reduce jump speed if not on ground (such as on ladder)
- Make water transparent, finally
2023-05-06 18:39:10 +08:00
En Yi c44696c1f8 Fix ladder spawning solid issue
Changelog:
- Add checks for ladder's solidity when spawning/despawning ladders
- Move crouch state check into player movement system
- Add ladder state for later implementation
2023-05-06 12:19:15 +08:00
En Yi b9a0bfe7b1 Add ladder toggling
Changelog:
Ladder acts as one-way platform on top, not solid otherwise
2023-05-06 11:49:12 +08:00
En Yi d59c902958 Change colour of one-way platform 2023-05-04 13:27:44 +08:00
En Yi b5e7d8846f Add collision handling for one-way tile
Internal Changelog:
- Add ONEWAY handling in check_collision
- All collision check now requires a prev_position check due to the
  one-way tile check. Update relevant function signature
- On ground check now does an edge check instead of using the offset
  check
2023-05-04 12:48:32 +08:00
En Yi 36e84d1b75 Add one way tile
Changelog:
- Add new enums for tile and solidity
- Modify check_collsion_and_move function to account for one way
  collision
  - Also remove the collision value as it is not used
- Add spawning for oneway tile
2023-05-02 21:54:29 +08:00
En Yi dc760bf8db Attempt to apply code style consitency
Squashed commit of the following:

commit 249fb96c63f68913ef632b8d1006e8a2d1c1b6d3
Author: En Yi <en.yi@tutanota.com>
Date:   Sat Apr 15 22:51:08 2023 +0800

    Ensure 120 column width limit

    Changelog:
    - this is just to avoid overly long line of code

commit 4b1ffa8fc89f17418de15f5fc3f0e73040f1d40c
Author: En Yi <en.yi@tutanota.com>
Date:   Sat Apr 15 20:05:07 2023 +0800

    Ensure style consistency in For loop

commit dcb41960407224592f78278313e97c2cc4bf66a5
Author: En Yi <en.yi@tutanota.com>
Date:   Sat Apr 15 17:26:20 2023 +0800

    Ensure consistency in code style

    Internal Changelog:
    - Use char* var instead of char *var. Preference
2023-04-15 22:52:38 +08:00
En Yi 82b8a3b988 Implement simple animation system
Changelog:
- Add sprite map for player
- Add an animation system
- Add a placeholder player sprite transition function
2023-03-18 13:55:55 +08:00
En Yi ac6d93565b Add Sprite Component
Changelog:
- Move Sprite struct into components
- Add asset field in engine
- Update scene test code to add engine for assets
    - This fixes the crash when q is pressed
- Add sprite component to player
- Update render function to draw the sprite
2023-03-13 21:12:37 +08:00
En Yi 1ea1db3c60 Update the test to use the get functions 2023-03-13 20:07:52 +08:00
En Yi d01a6772ec Add convenience scripts
Changelog:
- Add build and run scripts for convenience
- Update lsan suppresion file
2023-03-11 22:50:17 +08:00