Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mchtsyn

Pages: [1]
1
General / Re: Snake Game, detecting collision help!
« on: April 23, 2022, 03:15:04 am »
Thank you so much, solved!

2
General / Re: Snake Game, detecting collision help!
« on: April 22, 2022, 11:35:55 pm »
No sir, collision is not detected at all. I've modified the post, could you reply if you have any idea?

3
General / Snake Game, detecting collision help!
« on: April 22, 2022, 07:52:55 pm »
Hi, I am trying to detect collision between a snake(Rectangleshape) and an apple(Sprite).



The function that needs to detect collision is marked red as shown in the screenshot. It's not working at all. The problem is that when I write the same if statement that detects collision in the main function, it works fine. But when it's implemented in a class it doesn't work. I think my problem is referencing a class member which is from another class. Can you help..?

"snake" is the object for mySnake class.
"yilan" is the RectangleShape referance.
"sprite" is the sprite for Elma class.


screenshots:
https://www.hizliresim.com/du53hc8
https://www.hizliresim.com/hqk5ses
https://www.hizliresim.com/2szihm5

Pages: [1]