itch.io is community of indie game creators and players

Devlogs

Trident Function (Mostly)

Neptune's Trial
A browser game made in HTML5

This week I worked on and almost finished the trident throwing/recalling mechanics. I also added a script that resets the current scene when the player falls below the camera level, to simulate falling in a pit and dying.

To get the effect of the trident being thrown/recalled, I have place 4 separate game objects in the scene: one for if the trident is being held, one for if the trident is buried in a wall, one for if the trident has just been thrown, and one for if the trident is on its way back to the player. I’ve added a series of scripts to these objects that detect the relevant user input and toggle which object is active and which are inactive so that there is only ever 1 trident object active at any one time. when this active/inactive toggle occurs, I also set the appropriate positions and velocities to get the required function out of the trident.

I have encountered significant difficulty trying to get the trident to be thrown, however, as there doesn’t seem to be any reason why it would not have an initial velocity, but when thrown it just drops straight down due to gravity. There is also an issue with the trident sprite where it is rotated 90 degrees to the right of what I want it to be. I have bypassed this issue for now by just subtracting 90 form all my angle calculations, but I would really like to address this issue as I am concerned that it will cause issues later on.

I’ve also encountered another issue in my game so far, where the trident sprite points correctly at the mouse when the player is facing right, but wrong when the player is facing left. I have an idea on how to fix this and will work on it in the following week.

I am hoping to get some help/advice from my tutor to help resolve these issues, then I will start working on adding the collision detection and logic to make the trident stick into the wall when thrown, as well as adding the hole object at the end of the level to act as a trigger that ends the level. Then if I have time, I will work on adding a spike object that kills the player when they touch it.

These gifs show:

the trident sprite angle problem:

the inability to throw the trident:

the player being able to fall to their death:

and the recall functionality of the trident:

Files

  • Build.zip 3.1 MB
    May 03, 2024
Leave a comment