Commit Graph

163 Commits (a8e0d99870260d83e08e9865d48e04703a3c8fa5)

Author SHA1 Message Date
En Yi b70dcc1e98 Add activeness to ctransform
Changelog:
- Activeness determines whether to start moving or not
- Tile collision will skip inactive objects
- Crates are inactive on spawn
2023-06-26 20:42:32 +08:00
En Yi bb6da04e74 Change rendering for not 'moveable' tile 2023-06-26 20:19:38 +08:00
En Yi b5790ef00b Update spike orientation logic
Changelog:
- Remove redundant checks
- Add downwards tile check first
- Fix incorrect rightward tile check
2023-06-23 22:17:59 +08:00
En Yi 491f0bcbef Add extra check in crushing function
Changelog:
- Extra check to avoid just fringing the player bbox edges.
  Crushing requires actual overlap on at least one of the edges.
2023-06-23 22:12:20 +08:00
En Yi 7a670f85fc Extend one pixel outwards for tile collision check 2023-06-23 21:52:06 +08:00
En Yi e79fb249d2 Fix regression in one-way tile edge check 2023-06-23 21:33:40 +08:00
En Yi c7ef3f473f Add spike destruction
Changelog:
- Spike collision is now checked against all bboxes
    - Non player will destroy it
- Add moveable flag for each tile to determine whether a boulder can
  move into it
2023-06-22 23:14:07 +08:00
En Yi 3ee14d5f47 Add bbox check even for solid tile 2023-06-22 22:44:07 +08:00
En Yi 0f5a347cec Ignore fragile bbox when during player crush check 2023-06-22 22:38:22 +08:00
En Yi bb4a9a8f3c Improve crushing response
Changelog:
- Fix incomplete line-AABB collision check
- Add line-AABB check for grid
- Change len_reduction to 0
- Set tiles to check once during edge checking
2023-06-22 22:19:39 +08:00
En Yi 5267c318f2 Give display name when selecting entity to spawn 2023-06-21 23:40:08 +08:00
En Yi 2b878ae784 Add player collision with spikes 2023-06-21 22:32:14 +08:00
En Yi 451b241460 Correct AABB tests
Changelog:
- Figure out why the previous AABB behaviour was correct: continuum
    [0, 5) does not collide with [5, 10)
    For tile check however, need to subtract one to avoid extra tile
    check. Exception is the tile collision
2023-06-21 22:11:32 +08:00
En Yi c8d2ee5408 Improve crushing using edge testing
Changelog:
- Add len reduction to edge checking to give leeway in crushing
2023-06-21 21:27:13 +08:00
En Yi 4b91ab5667 Integrate line check into edge check function
Internal Changelog:
- Weird issue when using the new AABB functions, revert the off-by-one
  fix
2023-06-21 21:13:02 +08:00
En Yi 7767b38221 Add line-AABB collision check function 2023-06-20 22:23:32 +08:00
En Yi c27fa632a2 Add spikes spawning
Changelog:
- Add new tile: spikes
- Change bbox of tile of spikes depending on solid tiles position
2023-06-19 22:32:18 +08:00
En Yi 81da536e8e Add bounding box info in tiles
Changelog:
- Use more memory, but should help out in implementing spikes
2023-06-19 21:08:42 +08:00
En Yi a719c73c50 Remove dead code and add const 2023-06-17 13:53:21 +08:00
En Yi 63930fbe7d Update hitbox-hurtbox system
Changelog:
- Use atk and def values to determine whether a hitbox destroys a
  hurtbox
2023-06-17 13:08:07 +08:00
En Yi fc2001e428 Add system to destroy one-way tile with boulder 2023-06-17 11:50:23 +08:00
En Yi 21dafd1b6d Add kinematic mode to movement
Changelog:
- Kinematic mode ignores accelerations, that's all
- Update moveable to use kinematic mode and set accel & velocity to zero
  when entering gridmove mode
2023-06-16 16:28:19 +08:00
En Yi d39461cff1 Do two-pass for grid update 2023-06-16 16:26:20 +08:00
En Yi d455cbc6b9 Add test for AABB collision functions
Internal Changelog:
- Fix some off-by-one errors
2023-06-16 15:18:03 +08:00
En Yi 6005d3f490 Allow boulder to gridmove after a gridmove 2023-06-16 09:37:10 +08:00
En Yi a63daa2f81 Adjust movement to be a little 'responsive' 2023-06-16 09:17:35 +08:00
En Yi efa0035351 Add a point check for moveables before gridmoving 2023-06-16 08:55:58 +08:00
En Yi 371e6fcbdf Add delay to global external forces for entities
Changelog:
- Apply delay to crates and boulder
2023-06-14 21:00:14 +08:00
En Yi a1101cd951 Add player respawn system 2023-06-14 20:36:50 +08:00
En Yi 9e60d0fb89 Improve crushing logic
Changelog:
- Do edge checking in both direction on each axis. If either axis has a
  collision on both directions, crush the player
2023-06-14 20:29:23 +08:00
En Yi ae67ba4710 Improve ladder mechanics
Changelog:
- Ladder transition occurs only at falling
- Add tile snapping when going up and down
- Going down ladder from ground state no longer shift player's y
  position significantly
2023-06-14 19:09:24 +08:00
En Yi 7ce3894c79 Fix regression in collision system
Changelog:
- Revert tile collision checking to extend one pixel out rightwards
  and downwards
- Fix off-by-one error in complete overlap handling
- Remove check for empty space before moving as it causes more issue
  than solving them.
2023-06-06 22:07:30 +08:00
En Yi bab18dd5e9 Prevent crush by wooden crates
Changelog:
- collision check return status for:
    0 - no collision
    1 - non-fragile collision
    2 - fragile collision
- Update crushing function
2023-06-05 22:21:48 +08:00
En Yi 57cb3ef07a Improve collision system
Changelog:
- Add handling for complete overlap
    - It will attempt to move into an empty space near the checked
      entity. If no free space, it will move up. Ripe for exploit!
- Move boundary collision check into movement update
- AABB check now returns overlap mode:
    - 0: no overlap
    - 1: partial overlap
    - 2: complete overlap
2023-06-05 21:56:57 +08:00
En Yi dbf80508ec Integrate in player crushing system 2023-06-05 20:09:22 +08:00
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 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 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