Name Change and Score Labeled


  Day 2:


       I had an issue where the player would glitch to the center of screen and than back to the set position, this was fixed by accident. As I was working on the logic behind the game I realized I set the  players x and y position by  setting  position to get_global_mouse_position() so i tried out setting position.y = get_global_mouse_position().y. I suspect the reason for the glitch was the "position.x = 0" being called every frame.

This is what I changed in the player script to get a cleaner player lock on x-axis


       Yesterday when I started this project I had the idea that the player should try to be infront of the enemy as long as possible. I tried a raycast node and I think it could work however I couldn't get the functionality I wanted. Today I instead used a short piece of code that runs two checks. Both work together to see if the player is directly infront of the enemy.


the function I created to see if player is within 50px of the enemy


      I added a variable to control the radius that  the player is considered directly in front of the enemy. 


        finally I can detect the distance between the player and enemy and have converted that into a number that increases instead of decreases. This way I can continuously add the measurement to keep track of the score. It is not perfect but it is what I had in mind yesterday so thats a win. I also made a signal to emit when  the player is in enemy window.




       Now I think I should change what happens when the player and enemy collide, at the moment the game restarts. 



Have A Good One

Leave a comment

Log in with itch.io to leave a comment.