Image Point Issue With Animations

For questions about using Classic.

Post » Sun Feb 19, 2012 8:31 am

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. 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. Jim152012-02-19 08:33:25
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Tue Feb 21, 2012 6:27 pm

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?
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Wed Feb 22, 2012 4:51 am

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...
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Fri Feb 24, 2012 12:57 am

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.
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Fri Feb 24, 2012 4:22 am

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.Shindoh2012-02-24 04:28:27
B
3
G
1
Posts: 70
Reputation: 615

Post » Sat Feb 25, 2012 4:51 am

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:

http://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.
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Sat Feb 25, 2012 5:43 am

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.
B
56
S
20
G
7
Posts: 305
Reputation: 8,754

Post » Sat Feb 25, 2012 6:02 am

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: http://www.scirra.com/forum/image-point-problem_topic42266.html

I found another thread with the same problem. Doesn't look like it was solved though. Jim152012-02-25 06:19:29
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Sat Feb 25, 2012 10:55 am

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).Shindoh2012-02-25 11:13:24
B
3
G
1
Posts: 70
Reputation: 615

Post » Sat Feb 25, 2012 8:52 pm

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!
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests