Well, I'm working on a Tactical game, and I'm trying to use my own sprites, (Sprite_Unit to be specific), and the sprites aren't in negative space or anything, the game just apparently won't print things unless theyre x and y are > 0. (Keep in mind there are obviously tiles and such that are printed at 0,0; it just doesnt seem to work for me for whatever reason.)
This is the code I've made thus far:
class Sprite_Unit < Sprite
def initialize(unit)
super()
@unit = unit
@direction = unit.direction
@action = unit.action
@pic_frame = 0
self.bitmap = Cache.character(unit.actor.character_name)
self.x = unit.x
self.y = unit.y
@graphic_x = unit.actor.character_index % 4 * 96
@graphic_y = unit.actor.character_index / 4 * 128
self.src_rect.set(@graphic_x, @graphic_y, 32, 32)
end
def update
super
case @action
when "Standing"; update_standing
end
end
def update_standing
@pic_frame += 1
@pic_frame = 0 if @pic_frame >= 60
@pic_x = [0, 32, 64, 32]
self.src_rect.x = @graphic_x + @pic_x[@pic_frame / 15]
case @direction
when "Down"; self.src_rect.y = @graphic_y
when "Left"; self.src_rect.y = @graphic_y + 32
when "Right"; self.src_rect.y = @graphic_y + 64
when "Down"; self.src_rect.y = @graphic_y + 96
end
end
end
Note that if I use super(Viewport.new(0, 0, 544, 416)), nothing is printed, and yes, if self.x or self.y is 0, it doesn't print. Also, I originally used self.ox/y instead of graphic_x/y, but that didn't seem to work very well...