This site requires JavaScript, please enable it in your browser!
Greenfoot back
MrCohen
MrCohen wrote ...

2011/6/3

Place greenfootImage on top of greenfootImage?

MrCohen MrCohen

2011/6/3

#
I am working on a 2d tile "engine" in Greenfoot. I created a Location class (extends Actor) to manage each tile. Each Location holds a SceneryTile, as well as potentially an event (like a door or a chest or anything else that triggers an event in the game) or a Mob (any moving object - can be the player or an enemy). I am trying to find a way to have my Location create it's greenfootImage by superimposing the Event or Mob over top. I know I could just use seperate classes and set paint order but my current solution is somewhat eloquent and I would prefer to stick with it if possible. Thanks.
MrCohen MrCohen

2011/6/3

#
Never mind - I figured it out! This is the act method for my Location class, if it helps. public void act() { setImage(scene.getImage()); GreenfootImage g = this.getImage(); g.drawImage(scene.getImage(),0,0); if (this.event != null) { g.drawImage(event.getImage(),0,0); } //setImage(g); }
You need to login to post a reply.