RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Sprite Problem

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
 When I add a sprite to my scene, it is completely invisible unless it's x and y coords are > 0....Makes it hard to design when sprites cant touch the left or upper edge of the screen ever.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
You put it out of the boundary and want it to be drawn? Try assigning a viewport to it.

SO Sprite_dfkndk.new (Viewport.new (0, 0, 544, 416))

***
Rep:
Level 87
except whenever I assign a viewport, it disappears again...I never had this problem in XP either

src_rect works super funky too thanks to their goofy character graphic system..By that, I mean the width and height start from the left upper edge no matter what it's ox and oy are, which make it so it displays all character sprites to the left and above when I change the src_rect x and y. VX just stinks for this it seems. All I'm doing is printing a character graphic, and I'm getting trouble just printing a stationary sprite -_-

EDIT: So, I just took out the ox and oy, and replaced their use with @graphic_x and @graphic_y variables.
« Last Edit: May 30, 2009, 10:28:39 PM by da good king »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
What are you trying to do this for? It doesn't sound like you need to be using a sprite, certainly not one that goes outside of the screen boundaries. And what is the code you're using?

***
Rep:
Level 87
 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:

Code: [Select]
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...

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, you should use Sprite_Base since I would assume you will want to play animations.

But, that being said, Sprites definitely don't have a problem with being drawn at 0, 0 that I've ever encountered. The code you posted works fine for me, granting that I removed reference to the unit class and instead used an actor and set other things manually. It drew it at 0,0 without any problem. Are ou sure unit.x and unit.y are at 0, 0? Print it out before drawing maybe.

I don't know what else to say. It works in a project I made for testing purposes. I don't know why you can't draw sprites at 0, 0. If you send me the project that the error is occuring in, or else a project with the error reproduced, then I might be able to diagnose it from there. But nothing goes wrong for me.

***
Rep:
Level 87
i c, I may have to send you my project, as simply using
Code: [Select]
@sprite = Sprite.new
in a scene doesn't work unless I set a @spritex/y>0, which is how I became aware of the problem. I'll try making a new project and seeing if maybe I just accidentally messed with something.