asdru
asdru
JCHJava Community | Help. Code. Learn.
Created by asdru on 9/19/2024 in #java-help
scanner blocking thread close
:shrugging:
24 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 9/19/2024 in #java-help
scanner blocking thread close
I switched to using a buffered reader since its nextline function isnt blocking and that fixed it
24 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 9/19/2024 in #java-help
scanner blocking thread close
I did try that and i still had the same issue
24 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 9/19/2024 in #java-help
scanner blocking thread close
If i try closing the sender thread drom the reciever nothing happens because the interrupt function gets stuck wating for the sender's scanner to close/recieve input First
24 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 9/19/2024 in #java-help
scanner blocking thread close
Anyone?
24 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 8/7/2024 in #java-help
isometric tile setup
it helped but its still not perfect 😩 since its a 32x32 tile is it better to just write a function to round numbers up to the closest multiple of 32?
26 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 8/7/2024 in #java-help
isometric tile setup
yeah i know its bad practise
26 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 8/7/2024 in #java-help
isometric tile setup
thanks :)
26 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 8/7/2024 in #java-help
isometric tile setup
public void toIso(){
int screenWidth = GamePanel.instance.getScreenWidth();
int screenHeight = GamePanel.instance.getScreenHeight();

int newX = (int) ((x-y)*0.66)+screenWidth/2;
int newY = (int) ((x+y)*0.33)+screenHeight/3;
x = newX;
y = newY;
}
public void toIso(){
int screenWidth = GamePanel.instance.getScreenWidth();
int screenHeight = GamePanel.instance.getScreenHeight();

int newX = (int) ((x-y)*0.66)+screenWidth/2;
int newY = (int) ((x+y)*0.33)+screenHeight/3;
x = newX;
y = newY;
}
this is the new function but as u can see from the image the tiles arent perfectly aligned due to float multiplication. so instead of getting 48 i get 47 for example. is there a way to get the right value?
26 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 8/7/2024 in #java-help
isometric tile setup
No description
26 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 8/7/2024 in #java-help
isometric tile setup
No description
26 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
it had nothing to do with what i just said
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
oh god i found the issue...
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
i did some debugging and found that all the PlayableEntities in the arraylist are same object instance, otherwise i cant really explain why the position of all characters is the one of the last offset
public void initializeCharacters(){
initializeCharacter(party.get(0), new Vector2D(-20,-75));
initializeCharacter(party.get(1), new Vector2D(20,-25));
initializeCharacter(party.get(2), new Vector2D(-20,25));
initializeCharacter(party.get(3), new Vector2D(20,75));

System.out.println("current pos: "+party.get(0).pos);
public void initializeCharacters(){
initializeCharacter(party.get(0), new Vector2D(-20,-75));
initializeCharacter(party.get(1), new Vector2D(20,-25));
initializeCharacter(party.get(2), new Vector2D(-20,25));
initializeCharacter(party.get(3), new Vector2D(20,75));

System.out.println("current pos: "+party.get(0).pos);
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
No description
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
i'll see if that fixes the issue
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
ah ok thanks
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
but i think the root of my issue is the fact that this
public static PlayableEntity getCharacter(Characters c,GamePanel gamePanel){
if(c==Characters.PLAYER) return new PlayableEntity(gamePanel, "player",new Stats(100,20));
else return null;
}
public static PlayableEntity getCharacter(Characters c,GamePanel gamePanel){
if(c==Characters.PLAYER) return new PlayableEntity(gamePanel, "player",new Stats(100,20));
else return null;
}
returns the same address each time, which i dont really understand why
29 replies
JCHJava Community | Help. Code. Learn.
Created by asdru on 5/4/2024 in #java-help
Filling array with same object reference
i know oop, but its my first time making a big java project
29 replies