Commit Graph

310 Commits (43aa821c184af34b0a660a53e9d151fee2fcd634)
 

Author SHA1 Message Date
En Yi 7929178411 Add sprite loading from empty crates
Also adjust the gravity delay, bomb timing + size to allow
vertical chain explosion
2023-08-08 23:55:46 +08:00
En Yi c6b1e4e4b7 Add function to restart editor level 2023-07-29 17:47:18 +08:00
En Yi 0c52718695 Update water flow rendering logic 2023-07-26 23:16:50 +08:00
En Yi 2e368704ce Fix water runner interaction
- Add null check for bbox for moveable check
- Null after free when freeing runner
2023-07-25 20:43:39 +08:00
En Yi f81029b482 Add shape factor to control upthrust and friction 2023-07-25 20:39:42 +08:00
En Yi f6c5fa10fd Add simple water flowing visual 2023-07-24 23:59:19 +08:00
En Yi 478dea2d9c Add air pocket tile
Air pockets are just tiles with a max water level lower than the
absolute maximum

Also, make air pockets not reachable by water runners
2023-07-24 22:15:13 +08:00
En Yi 7d00d348f6 Put max water level into each tile
This is to create air pockets
2023-07-24 21:58:50 +08:00
En Yi ec8f8b6a36 Integrate water runner into main scene 2023-07-24 21:46:53 +08:00
En Yi 0a76826c27 Modify player collision with water blocks
Collision now handles different water level
2023-07-24 21:19:16 +08:00
En Yi 4a09550c0b Update main scene to do multiple water levels
Note: Player collisions not updated yet
2023-07-24 19:44:39 +08:00
En Yi 62c74fe545 Add water levels proper 2023-07-22 21:09:12 +08:00
En Yi eed785162e Update scanline fill function
Changelog:
- Fill only a range of reachable tiles instead
- Tweak fill complete check
    - Count tiles filled, if zero: complete
- Allow multiple runner to fill without breaking the game
2023-07-22 20:29:20 +08:00
En Yi cf807be7a2 Remove unnecessary state 2023-07-22 20:07:05 +08:00
En Yi 6097ec6e0d Complete basic water flow algorithm
Changelog:
- Add in scanline filling process
- Use signed integer for calculation
- Generalise BFS to only depend on the current cell
    - During the search for the lowest reachable tile, allow a single
      tile equal or higher to the starting tile
      This is to allow moving upwards when no valid lower tile exists
2023-07-22 15:52:55 +08:00
En Yi 89d962d2bc Fix runner bug of not reaching water surface
Also fix bound checking in runner
2023-07-21 21:19:38 +08:00
En Yi 6e2ccfa875 Improve reachability search for scanline filling
Just do a second BFS from the current position, reset the current
scanline reachability.
2023-07-20 23:25:32 +08:00
En Yi 7607827420 Split out state for resetting and starting BFS 2023-07-20 22:58:09 +08:00
En Yi 34655d5c0a Visualine reachable scanline
Also tweak logic for lowest point
2023-07-20 22:51:15 +08:00
En Yi dc20a6b992 Fix lowest point check and movement delay
- This allows separte movement delay for each runner
- Lowest point has to be not in water
2023-07-20 22:25:57 +08:00
En Yi a080b5ee0a Add water checks in BFS
Also refactor the BFS logic to generalise the next tiles to go
after the tile checks
2023-07-20 21:23:43 +08:00
En Yi 7af75b8366 Implement runner movement to lowest position
Changelog:
- Add new state for when runner reaches target position
- Skip movement if already on target position
- Add extra handling for spawning on solid tile
- Fix tile toggling bug on the same tile
2023-07-19 23:32:53 +08:00
En Yi a0f6cf3471 Visualise path from BFS + Improving BFS
Changelog:
- Avoid continuous BFS by changing state after BFS completion
- Reset to BFS state on tile change
2023-07-19 22:44:49 +08:00
En Yi 5b3cbd1bba Implement BFS into water runner 2023-07-19 19:16:35 +08:00
En Yi 917fdeba9b Fix incorrect entity deletion process
Changelog:
- Components of an entity are now freed on the spot
2023-07-19 19:15:16 +08:00
En Yi b52b662da9 Add water runner entity into game loop
Changelog:
- water runner needs ctransform + ctilecoord at least to be in the tile
  update system
    - Update the tilemap update system as well
- Update rendering function for water runner
- Update water runner creation to handle failure to create
- Add a tag for water runner (pending proper tag)
2023-07-19 11:15:34 +08:00
En Yi cf6dbcf481 Fix incorrect update of entity manager
Changelog:
- Clear to_update queue correctly
- Move entity deletion after adding
    - This is to allow deletion immediately after adding
    - Should be okay
- Fix incorrect null checking when adding entity
- Queue deletion when removing entity even if not found at removal time
    - The update function should handle such case
2023-07-19 10:55:16 +08:00
En Yi ebffd48958 Ready a water filler/runner entity
Changelog:
- Add new component: water runner component
    - specific for such an entity. Not general, but i dont really care
- Implement adding and freeing the water filler entity
    - Component involves dynamic memory allocation, so need custom
      function to add and free
    - May look into custom allocation for this part in the future.
2023-07-18 21:49:43 +08:00
En Yi aae61edda9 Refactor out broad phase grid collision functions 2023-07-17 21:14:02 +08:00
En Yi eaf75ec8ae Create test scene for water flow
Changelog:
- Nothing here yet
2023-07-08 21:05:00 +08:00
En Yi 06dd1d8be9 Add more tilemap bound checks 2023-07-06 21:54:16 +08:00
En Yi 39ff3313e8 Fix incorrect offset to check for uncrouching 2023-07-06 21:53:34 +08:00
En Yi 8c924956a8 Fix array out-of-bound error in tile collision 2023-07-06 21:43:48 +08:00
En Yi 5bbbaa19e2 Fix ladder not switching to one_way solid 2023-07-05 23:20:16 +08:00
En Yi 82efc711d0 Allow uncrouching under wooden crates 2023-07-04 23:46:42 +08:00
En Yi 4414747c79 Improve auto-crouch detection
Changelog:
- Move tilemap update to be at the start
    - This is to account for new entities being created
    - The post tile collision is not used for now
- Change auto-crouch collision check to check for entities as well
2023-07-03 22:57:13 +08:00
En Yi 966432867f Add delay in crate destruction
Changelog:
- Add Lifetimer and remove hurtbox on hit
    - Still insta-remove on player hit
- Fix adding a component to an entity that already has that component
- Reorder lifetimer update system
2023-07-03 22:18:35 +08:00
En Yi 5049efb952 Allow hitboxes to hit multiple hurtboxes 2023-07-03 20:57:17 +08:00
En Yi 256ea02d0b Add player interaction with bomb crates
Changelog:
- Add damage source for hurtboxes
- Add logic to handle player as damage source for bomb crates
2023-07-02 22:18:38 +08:00
En Yi ab582e723c Implement bomb's explosion 2023-07-02 21:52:19 +08:00
En Yi c4d8256767 Rework component addition/deletion procedure
Changelog:
- Defer component updates as iterator invalidation can occur
    - Add new struct for this + queue on entity manager
- Add new component: CLifeTimer
    - Basically a timer to live for entity
2023-07-02 21:49:15 +08:00
En Yi a4900a001b Add bomb crates
Changelog:
- Crates can spawn bombs
- bombs does nothing now
2023-07-02 20:37:16 +08:00
En Yi fe2bcdf8cd Add metal crate toggling
Changelog:
- Remove spawn option for metal crate
- Use M to toggle metal crate, applicable for arrow crates
2023-06-28 22:58:51 +08:00
En Yi 7dcff39864 Add direction to arrow spawning 2023-06-28 22:50:09 +08:00
En Yi e74f523b7f Handle arrow collision with tilemap
Changelog:
- Refactor function to change a tile type
- Destroy entities without bbox when OOB
- Add hitbox collision checking with tiles
- Add defense point on tiles
2023-06-28 22:19:20 +08:00
En Yi b578dd95f7 Add arrow spawning from crates
Changelog:
- Add function spawn arrow
- Update game system to handle null components
    - enough for the arrow to work
- Render arrow, sort of
- Initial implementation, definitely need more work
2023-06-27 22:11:14 +08:00
En Yi 9859854baa Add spawn entity selection via mouse
Changelog:
- Add row below game scene to select spawning entity
- Add mouse release logic to select spawning entity
- Update render order for tile
    - order: 'moveable' -> tile -> water level
2023-06-26 22:57:59 +08:00
En Yi f206d3c981 Update entity spawn + despawn function
Changelog:
- Check for mouse in game pos before mouse click check
- Right click will also remove entities now! Hooray!
2023-06-26 21:27:22 +08:00
En Yi dab8303cbe Update tile spawning
Changelog:
- Right click now removes tiles
- Water has its own spawn selection
2023-06-26 21:08:44 +08:00
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