• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Vector Sprite Problem

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Ranch Hand
Posts: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic