Image Point Issue With Animations

This forum is currently in read-only mode.
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I'm having a bit of an issue with image points in my platformer. I have a power up in the game that gives the player a weapon which shoots projectiles, and like in the Ghost Shooter tutorial, I figured all I would have to do was set the image point to the weapon. But whenever I have the player turn to the left (Thus mirroring the sprite), the projectile comes out at the wrong spot. It's not off by an awful lot, mind you, but it is quite noticeable.

    In addition, whenever the character does completely different animations (Like jumping for instance), and I have them shoot at the same time, the projectile comes out of their face. <img src="smileys/smiley36.gif" border="0" align="middle" /> I suspsect that's not an issue and just means that I have to make an image point for the jumping animation and account for that in my event sheets, but the first problem seems like a very odd issue.

    Any help would be appreciated. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • For me the action point is in the correct spot when mirrored. Do you have the action point correctly positioned in all you animation frames?

  • Yeah, I just double checked now to be sure, and for some reason, no matter what my character is doing (Be it jumping or running etc.), when facing left, the projectile always comes out slightly lower than on the right. Very strange...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So is nobody sure how to fix this? I may have to insert seperate sprites instead of mirroring it through construct, because I suspect that's what's causing this.

  • How about You just try to replicate the problem in a completely new .cap.

    I think it's a good habit to, before implementing something new to a bigger project, make the addition work in an empty project file, so You can always be sure, there is no other code interfering.

    That way, if it works, it should work when You implement it in the bigger project, and if it doesn't, then You know some other code might influence it.

    Also, in case You still don't understand why it doesn't work, when You only do this one thing in a new .cap (which also gives You a more clear overview of everything), when You ask for help on the forums, You can just post that new .cap only showcasing the problem.

    And along the same lines, before implenting, meaning, when You test Your idea in a new .cap first, You don't always need to go full on and add sound and graphics. Unless You wanted to test something related to that. You know, don't waste Your time with unecessary things.

    For example for Your problem now, You could just quickly double click the empty layout, add a new Sprite Object, in the Sprite Editor just fill the empty rectangle with some color with the bucket, add a colored dot on one side (left or right), to see which direction it is facing, save. Add another new Sprite, resize it to make it a little smaller, and fill again, save. This will be Your projectile.

    Now You have one big square with a dot (Your Player), and one small square (Your projectile).

    Now add Your MouseKeyboard Object and add the least necessary Events to do what You want to do: Turn left, turn right, shoot projectile according to the direction Your Player is facing.

    That'd just be about 3 Events, and everything together should just take You about 5 minutes to create, and You'd know if it works or not.

    Usually, You don't even have to rewrite the Events, when You want to add them to Your bigger project. For this to work, You just need to rename all the used objects in Your testcap to the same names they have in Your game. And if You added variables that the objects don't have in Your original bigger project, You just need to add the new variables to the related objects in Your game.

    Then You just select all the Events You want to copy from Your testcap, right-click on any of them and click 'copy'. Then You go to Your games' Event List and right-click paste them.

  • I took your advice and decided to make a simple cap trying to do what I want to happen in the main game. The problem still remains, but I did find something interesting.

    I originally thought that because my sprite was getting mirrored, the image point was as well, but I was wrong about that. As a test, I set the image point to the top right corner. Now, if the image point was being mirrored, the projectile would come out on the bottom left.

    But instead, the projectile continues to come out slightly lower on the mirrored side. I'm thinking this is a bug with the newest version of construct classic. Or I'm just missing something here. At any rate, here's the cap to show what I mean:

    dl.dropbox.com/u/42313097/Problem.cap

    Tap space to spawn the projectile... it doesn't move just so we can see the difference in where it comes out when it's mirrored.

  • It's kinda weird that it comes out a little offset when mirrored, but if mirrored it shouldn't come out the bottom left. It should come out the top left when mirrored if the imagepoint is set to top right normally.

  • Ah, you're right.

    I tested in one of the older versions of construct and I'm still getting the same problem somehow. So it looks like I was wrong about it being in the new release.

    I can't imagine something like this going unnoticed though. Does image point work okay for everyone else when mirroring?

    Edit: Also just tried using hot spot instead of image point, and the result is the same...

    Edit 2: scirra.com/forum/image-point-problem_topic42266.html

    I found another thread with the same problem. Doesn't look like it was solved though. <img src="smileys/smiley11.gif" border="0" align="middle" />

  • Okay, I've got some good news and some bad news.

    First, it's easy to solve Your problem. Double click Your projectile sprite to open the sprite editor. Now click on the symbol in the top row for 'cropping' the sprite (You don't actually have to do this, but again, it's a good habit for not wasting space, and some other purposes). Then go to it's hotspot and press '5' on Your keyboard's Numpad to center the hotspot.

    Try Your game again, and it will work. Because now, no matter what direction it is facing, it's origin is in the middle of the sprite. It will always be placed similarly, no matter if mirrored or not.

    Second, the actual problem. There seems to be a bug in the Platform Behaviour. If image points are used together with the Platform Behaviour to spawn an object, if the object spawning the new object is mirrored by the Platform Behaviour, it will not only automatically mirror the spawned object according to the spawning object, but also flip it upside down.

    In the case of Your projectile sprite, since Your hotspot is not centered, the empty transparent space between the middle of the projectile sprite and the actual sprite will now be flipped upside down. Now instead of having the empty space on top of the center of Your projectile sprite, it will be at the bottom. Resulting in the projectile appearing slightly lower on the left, when it is flipped upside down (which shouldn't happen anyway).

  • That fixed the problem like you said. If centering the sprite is the work around for the bug, I can live with that, no big deal.

    Thanks for all your help!

  • Actually, just realized what was going on. It's not actually a bug, but rather working as intended.

    When you spawn an object through an instance of another object, it automatically sets the "child" object's angle to the "parent" object's.

    Set "Sprite3"'s hotspot in your cap to any location you want, off center (just to show you that it works properly is all). Then go to "Sprite3"'s Angle options and check Auto-mirror. It will spawn at the correct position.

    No bugs, just hidden features that need to be accounted for. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • You're right. Could have sworn it was a bug too, but as usual, I'm wrong about CC stuff.

    Thanks to everyone for the help!

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