FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  


FIFE 0.4.0 has been released on 15th of January, 2017!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Kresp

Pages: [1]
Game creators corner / Basics of instance and object manipulation
« on: December 10, 2012, 07:27:04 am »
I've just recently started to use FIFE and, to familiarize myself with it, i'm writing a simple app for solving sudoku puzzles.
What i can not figure out myself is the best way to transform values inside cells.
I've decided not to use runtime text output, but to create an atlas of 10 squares, with numbers alredy drawn on them (from 1 to 9 and and empty one). So the tileset has 10 objects with ids from 'tile:1' to 'tile:9', and 'tile:0' for the empty square.
My first intention was to use Object.setId method to transform a tile, but it does not seem to make any visible alterations. The id gets changed(getId() now returns different value for this object), but engine renders same image on top of the object.
So now i'm trying to delete current object, and create a new one in old one's place. I use Layer.deleteInstance method, and it works fine. But when i try to create a new one, the app breaks somewhere inside engine's pump() method, and my Python debugger doesn't catch any exceptions to trace.
That's how i try to create a new object and add it to current layer:
Code: [Select]
object = instance.getObject()
coordinates = instance.getLocation().getMapCoordinates()
new_object = Object('tile:0', '')
self._cell_layer.createInstance(new_object, coordinates)
Can you give me a hint to what i'm doing wrong? Sorry for my english grammar, it's probably horrible.

Pages: [1]