This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vector Sprite Problem

 
pantelis pantelakis
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to create a List/Vector/Array of sprites.
It seems that i have created it but it is not visible allthough I can system.out.println information.
It is also setVisible(true);

Can anybody help??
 
Mich Robinson
Ranch Hand
Posts: 260
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pantelis pantelakis wrote:Hi

I want to create a List/Vector/Array of sprites.
It seems that i have created it but it is not visible allthough I can system.out.println information.
It is also setVisible(true);

Can anybody help??

Can anybody help? you've provided no code and no real idea of what's going wrong so I'm guessing nobody will be able to help you.
 
pantelis pantelakis
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are write.
Sorry.


Bellow the GameDesign Class


public class GameDesign {
public Vector ar = new Vector(2);
private Image platform_tiles;
public int[] objseq001 = {68, 68};
public Vector ar = new Vector(2);

public void updateLayerManagerForTestLevel(LayerManager lm) throws java.io.IOException {


...

getObjAr(0).setPosition(176, 144);
getObjAr(0).setVisible(true);
lm.append(getObjAr(0));
}

public Sprite getObjAr(int i) throws java.io.IOException {
if (ar.isEmpty()) {
// write pre-init user code here
System.out.println("getObjAr");
//Image platform_tiles1 = Image.createImage("/topview_tiles.png");
ar.addElement(new Sprite (getTopview_tiles(), 16, 16)) ;
((Sprite)ar.elementAt(i)).setFrameSequence(objseq001);

// write post-init user code here
}
System.out.println(((Sprite)ar.elementAt(i)).getWidth());
return (Sprite)ar.elementAt(i);
}


And here the TestGameCanvas

public TestGameCanvas() {
...
private void init() throws IOException {
this.timer = new Timer();
this.gameDesign = new GameDesign();
...
this.ar.addElement(gameDesign.getObjAr(0));
}
}

This is the code.

But nothing seems to be visible ...

Any body please for a hint or an idea?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic