Closed pcrossy closed 12 years ago
well, it's not a MarteEngine problem, because this part of the code:
if(check("ATTACK")){feuerball = new Feuerball(500,500);world.add(feuerball);System.out.println("Entity erstellt!!");} if (check("REMOVE")){world.remove(feuerball);System.out.println("Deleted!!");feuerball.active = false;}
if you check attack and add a new entity "feuerball" is not null, you can remove it, but if you don't add feuerball to world before remove it, you have nullpointer.. but not on remove, on "feuerball.active", because feuerball is null, right?
Ye sorry i knew that this is no issue currently ,but now i fixed the code to get the nullpointer out ,but its still not removing the entity`s.Now i changed this
if(check("ATTACK")){feuerball = new Feuerball(500,500);world.add(feuerball);System.out.println("Entity erstellt!!");feuerballcounter= feuerballcounter + 1;}
if (check("REMOVE") && feuerballcounter >= 1){world.remove(feuerball);feuerballcounter = feuerballcounter - 1;}
I don`t know what is going wrong now i made the code really simple.
Ok now i know where my problem is!!How can i explain that only 2 fireballs can be in world at once?I tried this but it´s not working cause when I press the my ATTACK its producing much fireballs whether i set the counter to 2 or 1 .I
m saving all my fireballs in 1 fireball so if I press attack it ´s generating 10 fireballs if i now press my remove button its only removing the last generated fireball can you help me fixing this problem i don
t know how maybe i`m just to dummie.
Yeah no problem :D when you press attack, you can count how many fireball type there is in a world using this:
https://github.com/Gornova/MarteEngine/blob/master/src/it/marteEngine/World.java#L256
You See that's why i need a API Doc XD Gonna try it tomorrow!! Thanks Closed
Hello i
m new in Marte Engine development and just got a hard problem in removing the f***** Entity if i remove like in the Tutorial said i
m getting the awesome NullPointerExeception my Codepublic class Feuerball extends Entity{
Feuerball feuerball;
public Feuerball(float x, float y) throws SlickException { super(x, y); define ("ATTACK",Input.KEY_W); define ("REMOVE",Input.KEY_K); Image fire = ResourceManager.getImage("xxx"); setGraphic(fire);
}
public class Welt extends World{
Hope i copied all the code please help me it´s annoying and could you please make a API Doc this would be chilled.