xReference and xScale for mirroring a sprite

I am using Spriteloq to animate a simple character, and I want to mirror him along his feet. I drew a red line in Flash to denote where I want the mirroring to occur. The first frame contains the red squiggles simply to stretch the frame. Here are some screenshots:




However when I load the sprite and set the xReference and yReference, it only mirrors slightly correctly with the biggest frame, and the rest flip incorrectly when xScale = -1.0:



Do you think there is something wrong with my setup? Or is this simply a bug. Thanks… [import]uid: 58642 topic_id: 11389 reply_id: 311389[/import]

Additionally, The Android simulator apparently continues to keep my image files open (even when I unload the project) so I have to close it completely just to overwrite an image. It would be nice if closing the project also closes all files. [import]uid: 58642 topic_id: 11389 reply_id: 41280[/import]

Hi elliotlp,

Can you post a code snippet of how you’re setting setting the xReference and xScale?

Also, if you’d like you can send me an email at support@loqheart.com along with any sample files, and I’ll help you debug.

Thanks.

-Don [import]uid: 27183 topic_id: 11389 reply_id: 41312[/import]

Hi elliotlp,

I’m guessing if you’re modifying the xReference value of your sprites with Spriteloq there might be something weird in your code setup. I recorded a quick video, showing some sample graphics getting aligned and displayed with some sample code.

I hope that helps: http://www.youtube.com/watch?v=-7Fy24mBiKU
[import]uid: 27183 topic_id: 11389 reply_id: 41316[/import]

Thanks, but I have followed similar steps (even using a separate swf for the guide) and used similar code, but my sprite still gets offset when it plays the squiggle frame. I have included a complete zip file in hopes of finding out what has gone wrong:

link.

Note I exported the sprite to loop its animation. Thanks. [import]uid: 58642 topic_id: 11389 reply_id: 41404[/import]

Hi elliotlp,

I took a look at the code, but I’m still not sure what’s the intended effect you’re looking for. I’m not seeing what you mean by the squiggle frame is offset. Is there anyway you can do a screen capture to explain the effect your looking for?
I edited and reposted your code sample below creating another sprite for comparison. Is that what you’re looking for?

Updated to include a screencast:
http://screencast.com/t/ZVcdLQaqnog

  
 -- Require the module  
local loqsprite = require('loq\_sprite')  
  
-- Create a SpriteFactory and include some spritesheet modules  
local spriteFactory = loqsprite.newFactory('Pirate')   
  
-- Create a SpriteGroup instance and pass in an initial animation  
local si = spriteFactory:newSpriteGroup('pirate')   
  
-- Position the spriteGroup instance  
si.x = 200   
si.y = 300  
si:play()  
  
-- For atrace and xinspect  
require('loq\_util')   
  
-- Prints out the table of animations: standing, running, jumping  
atrace(xinspect(si:getSpriteNames()))   
  
-- Everything above works correctly. The pirate's feet don't move  
-- Then I want to flip him to face the other direction, but  
-- his feet get offset incorrectly...  
  
si.xScale = -1  
  
-- here I've created a new sprite with normal scaling, but added a touch handler to flip him.  
local si2 = spriteFactory:newSpriteGroup('pirate')  
si2.x = 200  
si2.y = 200  
si2:play()  
  
local function onTouch(\_e)  
 if \_e.phase == 'began' then  
 si2.xScale = si2.xScale \* -1  
 end  
end  
  
Runtime:addEventListener('touch', onTouch)  

Also, we just posted a series of tutorials to youtube that cover:
Flash export: http://www.youtube.com/watch?v=iOvI4el8Q1U
Spriteloq alignment and export: http://www.youtube.com/watch?v=Z7PYgq6cPXU
A sample application: http://www.youtube.com/watch?v=OqwU1pggpJY

I hope those help. If you need faster support you can reach me at support@loqheart.com
[import]uid: 27183 topic_id: 11389 reply_id: 41405[/import]

With Don’s help, this is now solved! I upgraded to Corona 544 and now my pirate’s feet is always stationary. I assumed I grabbed the latest version a week or two ago, before becoming a paid subscriber.

My mistake… =/ [import]uid: 58642 topic_id: 11389 reply_id: 41421[/import]

For anyone else following this thread. We were able to resolve the issue. Looks like it was solved by getting the latest build.

Maybe it was related to the sprite fix in build 526 which I documented here:

http://www.youtube.com/watch?v=2oxO149V8VA
[import]uid: 27183 topic_id: 11389 reply_id: 41422[/import]