[R105] & [R103.2] added frames get wrong origin

0 favourites
  • 3 posts
From the Asset Store
Customize the animation of character when item changed
  • This fails in both versions.

    I have an animation which consists of 9 square frames of the same size, all with the origin (aka hotspot) set to 0,0.

    Now I want to add additional frames (also square with the same size).

    I add the frame in the frame editor, then "open" the image in the sprite editor, and by default the origin is already set to 0,0 - great!

    Except that when the new frame is displayed, it is using an origin which is the center of the image (not 0,0). Now if I try and change any origin (e.g. to 1,1), when I close and open the animation/sprite editor, it goes back to 0,0.

    It seems that behind the scenes the new frame is using the center as the origin, but is displaying 0,0 in the sprite editor.

    This is pretty serious - I've come to a bit of a halt.

    I cant delete the sprite and start again, as it will delete the hundreds of events which are using that sprite.

    This should be easy to reproduce (just create a sprite with a few frames, set the origin to 0,0, save the project, close C2, then open the project, add a new frame, then "open" the file containing the image, verify the origin is 0,0, then display the image in the game - it should appear offset by -0.5*width and -0.5*height

    I created the original frames in an earlier version of C2 (R95?)

    Let me know if you need a capx.

    Here is a snip of the animation in the project file:

               <frame duration="1" hotspotX="0" hotspotY="0" />
               <frame duration="1" hotspotX="0" hotspotY="0" />
               <frame duration="1" hotspotX="0" hotspotY="0" />
               <frame duration="1" hotspotX="0" hotspotY="0">
               <collision-poly>
                       <point x="0" y="0" />
                       <point x="0.991803" y="0.00819672" />
                       <point x="0.991803" y="0.991803" />
                       <point x="0" y="1" />
               </collision-poly>
               </frame>
               <frame duration="1" hotspotX="0.5" hotspotY="0.5" />
    

    Note the last frame has the wrong hotspot. However, in the sprite editor, its coming up as 0,0

    Also, why would some of the frames have a collision polly, and some not?

    Would it make the game faster if I deleted the collision plolys (which I dont need in this case)?

  • I can't reproduce any problem. I tried following your steps:

    1. Create a new sprite

    2. Add two frames each with an origin of (0, 0)

    3. Save and close

    4. Reopen C2

    5. Double-click the sprite and add a new frame

    6. Open another image file

    7. Set the origin to (0, 0) again

    8. Run project

    At every point everything appears fine.

    Please remember to be as clear as possible when reporting bugs - step by step repros are useful, because I'm not exactly clear precisely what you are doing when you say "then "open" the file containing the image, verify the origin is 0,0". My interpretation is above. If you add a new frame and click the open icon to import an image, it is by design that the origin defaults to the middle. So I'm not sure why you would "verify the origin is 0,0" because it never will be; so I interpreted your steps as "set the origin to 0,0". If I've done something different please let me know.

    Edit: collision polygons are omitted in the XML if they are the bounding box. Note your example includes a poly which is very, very close to, but not exactly, a bounding box. To avoid this problem always right-click and select 'set to bounding box', since doing it by hand can cause these tiny offsets, and collisions are faster if they are an exact bounding box.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, found the problem, many apologies.

    I thought I was in origin setting mode in the sprite editor, because the origin x/y dialog was visible. It turns out it was in polygon setting mode.

    This may explain why some sprites got slightly off polygons.

    My bad, sorry.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)