File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Vector Sprite Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Vector Sprite Problem" Watch "Vector Sprite Problem" New topic
Author

Vector Sprite Problem

pantelis pantelakis
Greenhorn

Joined: May 13, 2011
Posts: 3
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

Joined: Jun 28, 2009
Posts: 250
    
    1
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.


Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
pantelis pantelakis
Greenhorn

Joined: May 13, 2011
Posts: 3
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
 
subject: Vector Sprite Problem
 
Similar Threads
swing-ejb
vector
Can new vector be null ???
I want to iterate all elements in vector and store it in another vector..?
Jtable boolean checkboxes