22 Replies
⌛
This post has been reserved for your question.
Hey @teyaaa12! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
oh you are the same as https://stackoverflow.com/staging-ground/79321824
Are you sure you are only changing
public void checkTile(Entity entity)
to public void checkTile(Player entity)
and this fixes the issue for players?💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Yes, changing public void checkTile(Entity entity) to public void checkTile(Player entity) solves the issue of the player colliding with tiles that have collision. However, this causes a problem when I add NPCs, as the method then requires reverting to public void checkTile(Entity entity). According to Ryisnow, the method should remain as public void checkTile(Entity entity) for it to work without errors. The issue with public void checkTile(Entity entity) is that when my player touches a tile with collision, the player becomes stuck. Additionally, if the player touches an NPC, both the player and the NPC become stuck.
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
oh
so you have variables like
screenx
etc defined in Entity
but also in Player
why do you have them multiple times?
This results in each Player
having these variables twice and if you access them via Player
, you can the Player
ones but if you access them using Entity
, you access the entity one
so that's why you get different resultsActually, their values are the same, so should I remove those variables from the Player class since it is a subclass of the Entity class?
Are you sure the values are always the same?
if you change the values in one of the classes and then access them from the other, you won't get the changed values
this is exactly what causes the difference between
checkTile(Player entity)
and checkTile(Entity entity)
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
The variables, such as solidarea, etc., represent the solid areas of the NPC and the player. I tried assigning them directly in my Entity class, but it does not resolve the issue of them getting stuck.
?
these are the issues
Can you show your updated code that doesn't have duplicate variables?
Did you remove the variables from Entity?
oh nvm
so
screenx
and screeny
still exist multiple timesOh, sorry! So, I removed the declaration of public int screenX and screenY from my Player class. However, if you're referring to this:
screenX = gp.screenWidth / 2 + (gp.tileSize / 2);
screenY = gp.screenHeight / 2 + (gp.tileSize / 2); It's only in the Player class, and it represents the player's position on the screen.
screenY = gp.screenHeight / 2 + (gp.tileSize / 2); It's only in the Player class, and it represents the player's position on the screen.
it can still be done in the Player class
if player refers to screenx, it would access the one from the entity class
Yes, but I still have the same issue as in the video.
I think I have a problem with my collision logic in the collision checker class.
Do you know what a debugger is?
yess
Did you try setting a breakpoint in the collision logic to see what happens?
like comparing it with your expectations
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.