c99999c0c9
fix calculated distance for helpGetRightwardsPath (reused same distance calculate as in helpGetUpwardsPath before)
Humza Shahid2025-01-18 13:52:21 +00:00
00a9f22151
keep track of visited nodes to prevent infinite recursion
Humza Shahid2025-01-18 10:09:08 +00:00
f796f2f858
have functiokn to get upwards path semi-working
Humza Shahid2025-01-18 00:25:27 +00:00
560ef3f99a
add function to get ID of first item found at location in quad tree (returns ~1 instead of NONE if no item is found)
Humza Shahid2025-01-17 21:48:18 +00:00
cbddc03a88
progress towards implementing follow slime (slime only tries jumping when platform is reachable now)
Humza Shahid2025-01-17 13:18:02 +00:00
20e34ca0d5
add function that returns true if we can jump on platform
Humza Shahid2025-01-17 12:29:07 +00:00
c7bd95e5d7
distinguish between standing on wall vs standing on platform (platform can be jumped on but wall cannot)
Humza Shahid2025-01-17 11:49:34 +00:00
67a4ad5664
start implementing patches to follow player (basic; shouldn't use path finding like Dijkstra's algorithm)
Humza Shahid2025-01-17 11:43:49 +00:00
a05f211428
pass player record as argument for enemy filtering functiokns, so enemy can react to player state (position, etc.)
Humza Shahid2025-01-16 08:15:29 +00:00
0c01b224d0
slight refactoring to help with extensibility of adding enemy variants later
Humza Shahid2025-01-14 11:50:27 +00:00
90c29ebe24
make enemy's speed slightly slower than player's speed
Humza Shahid2025-01-13 12:53:50 +00:00
2c643a1500
change speed that projectile moves at (should be faster than player)
Humza Shahid2025-01-13 12:46:10 +00:00
2a940a9392
done with patroll function, successfully making enemy switch directions while patrolling
Humza Shahid2025-01-13 12:40:23 +00:00
ee5f3c628d
progress towards having enemy patrol area when on wall/platform
Humza Shahid2025-01-13 11:28:49 +00:00
690bfe75da
make plan for writing how enemy should patrol on wall/platform
Humza Shahid2025-01-13 11:02:34 +00:00
50238b8dac
done getting physics + environment to work on enemy as well, in addition to player
Humza Shahid2025-01-13 09:52:25 +00:00
ca6b0b2160
done refactoring player-specific logic, and also enemy-specific logic, from player-enemy.sml (which now just calls different functions from the player.sml and enemy.sml modules, to help player-enemy.sml maintain a high level overview)
Humza Shahid2025-01-12 22:14:36 +00:00
ec44dd9966
refactor constants out from player.sml
Humza Shahid2025-01-12 11:46:32 +00:00
a7c2e2ef01
progress moving constant values into own module
Humza Shahid2025-01-12 07:18:44 +00:00
49282887e3
remove enemyTree (quad tree holding enemies) from game type as this is not static geometry and, since enemies are moving every frame, this should also be regenerated on every frame
Humza Shahid2025-01-11 22:06:08 +00:00
75e28b892e
done getting player's projectiles to collide with enemies successfully, and tested (although the code of the enemy reacting to the player is not the best)
Humza Shahid2025-01-11 21:35:55 +00:00
0367b3a23c
progress detecting collision between enemy and player's projectile, and decrementing enemy's health once detected
Humza Shahid2025-01-11 13:45:29 +00:00
df0926195d
decide on a different structure/module for each collision
Humza Shahid2025-01-10 10:12:59 +00:00
deb24c2063
with cursor movements, instead of passing in functions as parameters (callbacks/higher order functions), functorise the cursor movement functions instead so we can take advantage of defunctorisation and avoid the runtime cost of closures/higher order functions/function pointers
Humza Shahid2025-01-09 22:30:51 +00:00
f9f56e3b38
make sure projectiles are shot from the same x/y coordinates they are spinning at from the player
Humza Shahid2025-01-09 15:00:56 +00:00
941d90b6be
ensure that we do not draw field over player when player is throwing
Humza Shahid2025-01-09 10:38:34 +00:00
a2dc00704c
add 'facing' field to player projectiles, so it is known which direction projectile should travel in
Humza Shahid2025-01-08 20:26:53 +00:00
bd946bf635
require attack button to be pressed twice in order to trigger throwing of defeated enemies
Humza Shahid2025-01-08 13:18:35 +00:00
f7ee3e9e29
when attack is pressed and more than one enemy has been defeated, place defeated enemies into projectiles vector, and make the vector of defeated enemies an empty vector
Humza Shahid2025-01-08 12:49:29 +00:00
29de4ea4b6
progress shooting off enemies as projectiles
Humza Shahid2025-01-07 13:31:17 +00:00
c080398dd5
multiply defeatedSize by ratio to ensure that pellets change size along with other objects when window is resized
Humza Shahid2025-01-07 13:03:17 +00:00
f7f9b1e29b
turne 'defated_enemies' type into '{angle: int}' record, because it is probably visually cleaner to have defeated enemies turn into small pellets
Humza Shahid2025-01-01 09:38:04 +00:00
2eb2de8910
change alpha opacity of attack depending on current charge
Humza Shahid2024-12-31 10:08:18 +00:00
40c5222621
done adding ability to change different colours in both functional core and imperative shell
Humza Shahid2024-12-30 04:32:15 +00:00
fc69a0e4c3
progress with setting rgb (add functions to set in app type)
Humza Shahid2024-12-30 04:14:07 +00:00
5dde0517cc
progress adding ability to change colour of triangle
Humza Shahid2024-12-30 03:41:11 +00:00
b41cb87b41
fix error trying to parse rgb colour data from file (have tested the change works; error was that code was meant to parse 'b' but was parsing 'B' instead)
Humza Shahid2024-12-29 20:27:48 +00:00
7c2cc66b5a
allow loading of files with or without rgb colour data
Humza Shahid2024-12-29 20:22:11 +00:00
43eb5f4448
add [r, g, b] field to triangle, so we can draw coloured objects (next: add ability to change current colour)
Humza Shahid2024-12-29 20:18:29 +00:00
7d09661e98
use different collision size when player is attacking
Humza Shahid2024-12-28 04:11:29 +00:00
5f437ae76d
draw basic field over player when player is attacking
Humza Shahid2024-12-28 04:06:27 +00:00
fccbb15f15
add shader strings which will allow us to make an xyrgba shader in OpenGL
Humza Shahid2024-12-27 20:48:36 +00:00
8804847d7a
use binary search to find enemy with ID in 'GameUpdate.checkEnemies' function, because we previously relied on the enemy's index
Humza Shahid2024-12-27 18:26:57 +00:00
ada63d54ce
progress on player-enemy collisions when player is attacking enemy
Humza Shahid2024-12-27 18:12:42 +00:00
01bc91e201
return (player, enemies vector) tuple from function to check player-enemy collisions, because we will later want to update both player and enemy in the event that both collide
Humza Shahid2024-12-27 17:32:42 +00:00
6f83fd8636
change collision function in player.sml to check only for collisions with environment, because plan is to move player-enemy collision detection out of player.sml into game-update.sml (where player-enemy collisions affect both players and enemies)
Humza Shahid2024-12-23 18:49:50 +00:00
6bb9ba315e
remove unused parameter, and clear checkEnemiesWhileUnused function, because have a different idea for attack
Humza Shahid2024-12-23 04:03:54 +00:00
5819c4facf
add code to stop player from moving when main attack is pressed
Humza Shahid2024-12-23 00:28:53 +00:00
d8b70dfccb
draw player differently when they are attacking (player is just different colour for now; placeholder asset to change for later)
Humza Shahid2024-12-22 21:08:59 +00:00
400b971c7b
add main attack patches to player.sml, registering attack input (although we don't react on the attack input yet)
Humza Shahid2024-12-22 20:21:16 +00:00
e2b89af6ac
refactor player.sml for easier extensibility when fields are added to player type (we accept a list of values to change, instead of destructuring the player.sml values on each function call)
Humza Shahid2024-12-22 05:40:33 +00:00
05ec1880d2
remove dead code (an '(r, g, b)' tuple) and an outdated comment (about a compiler error) from player.sml
Humza Shahid2024-12-21 11:15:03 +00:00
c71dbb7fca
add facing datatype to player record, which represents the last position the player is facing (player is facing left if they moved leftwards or colllided with an enemy who is to the left, and player is facing right if they move rightwards or player collides with enemy who is to the right)
Humza Shahid2024-12-20 17:41:21 +00:00
aeb3756e5b
change arrow keys (left, down, right) to letter keys (s, d, f) and arrow up to letter key 'k', because I think it is more comfortable
Humza Shahid2024-12-20 16:51:21 +00:00
1e2ebe066f
slight improvement to attacked animation in player.sml
Humza Shahid2024-12-20 08:17:33 +00:00
165abe32ba
add player-flashing animation when player is attacked
Humza Shahid2024-12-20 07:55:10 +00:00
71e62a101d
add player_attacked datatype to player record, and refactor
Humza Shahid2024-12-20 07:38:54 +00:00
58f552b38b
add player_attacked datatype to player record, and refactor
Humza Shahid2024-12-20 07:38:41 +00:00
fec4d996d9
fix bug. Bug was: if player jumps on platform while holding up, and walks off platform while still holding up, the player has the same 'y' coordinate, floating in the air when gravity should be applied. Fixed by applying gravity in the onJumpPressed function, when jumpPressed variable is true.
Humza Shahid2024-12-19 08:10:34 +00:00
65ce098a71
have proper state transitions for recoiling; tested, and works correctly too
Humza Shahid2024-12-19 07:53:31 +00:00
9ed32f38d2
separate RECOIL state to RECOIL_LEFT and RECOIL_RIGHT, telling us which direction player reccoils from
Humza Shahid2024-12-19 04:09:03 +00:00
8dc5ad9359
add recoil state for player (next: enter recoil state when player touches enemy)
Humza Shahid2024-12-19 03:58:37 +00:00
07782c7d65
add code to: (1) draw platform (shell.sml), (2) fix wall collision detection regression and platform collision detection bug (I was meant to pass one y parameter and one x parameter to the QuadTree for querying, but accidentally sent the y coordinate twice), (3) perform necessary state transitions that allow to drop from platform when pressing down on a platform, and (4) make sure player does not stick to platform if they jump to platform from below
Humza Shahid2024-12-18 03:30:21 +00:00
d0360df871
change platCollisions value to check for collisions in platformTree instead of wallTree
Humza Shahid2024-12-18 00:18:24 +00:00
1501f5f556
add comment about what code is triggering a compiler error
Humza Shahid2024-12-17 23:49:40 +00:00
3ce2a974ba
I think functions to drop below platforms have been coded and work fine, but I can't manually test because of an exception during compilation. So save progress by pushing to GitHub for now.
Humza Shahid2024-12-17 22:45:58 +00:00