#2 problems with my game!!

7 messages · Page 1 of 1 (latest)

fringe fjord
#

hi, im a newbie godot programmer. i have 2 problems w my game - when i press f5 (run) my drag and dropping does not work, but when i click f6 (run current scene) it works just fine.

second, i only intent for the hand which gets touched to increase fingers (like when the player's left hand touches the opponent's right hand, only the latter gains fingers, e.g. gains 1 finger) however, it does not work the way i desired it to be. can someone help? thank you so much.

code relating to the problems: https://pastebin.com/BP9RjX9P

the video below should show what i mean: https://www.kapwing.com/videos/641c45448e610c02b80da4bf

teal crystal
#

I don't think that I can answer the question, but I can see how the logic is going to keep getting more and more complicated.. Would this be a case where building a Finite State Machine might be a helpful approach? Also, carefully setting the collision masks and layers may help prevent some unwanted interactions...
Hope someone else has more concrete answers to your questions.

teal crystal
#

As a relatively new Godot programmmer myself, this is quite interesting to me. I'm going to play around with it a bit and see what I come up with. Maybe I'll have a helpful suggestion in a week or two, as I am also busily working on the final lessons in Learm to Code from Zero.

teal crystal
#

So, as far as i can tell, is that when the two area2Ds overlap each other, they both detect each other simultaneously and both graphics change in unpredictable ways, possibly because a looping action occurs. There are probably several ways to cirumvent this, but this is what I came up with.
I created separate detection areas for each player's hand, so that when one the opposite player's hands enters/exits that area, the attached code will change the number of extended fingers on both hands based on their current values. I used layers and masks, and set monitoring and monitorable to make sure that only the active player is controlling the changes.

#

For changing the images of the hands, I attached different textures to a sprite object, and managed the change in the receiving hand by using an array to both do the caculation and change the image. Here's part of the code: