Quirk with image point.

Get help using Construct 2

Post » Mon Apr 30, 2012 7:30 am

Hi, new to the forums, being testing the tool for the last couple of days and must admit that I'm loving it!
I was writing a long post about some odd behaviors with a test I'm doing, but while I was writing and making sure I was getting my results right, found the solution for most of my problems. Odd hicups in firefox appears to be gone from my test with the updated version (12), and the other was a silly mistake in toggling my variables, need to be more carefull with these.

One still puzzles me: being doing a port from a previous platform game that I worked on, as a test, and needs to attach a flame sprite to the character when I do a double jump (double jump is working nice, no problem). Created, as said in the tutorials, a player box with the platform behavior, then create a sprite with the images/animations of my character pinned to player box, and then set the flame sprite to the proper imagepoint of the image sprite (Every tick -> Set position to (Player.ImagePointX("Flame"), and Y as well)). When I do a double jump standing still, the sprite seems to appear in the right spot, just a little down, but when I do it running, the sprite appears moved off center; not by much, but sufficiently to not fit right where it should.

Am I doing something wrong?

The animations for "double jump still" and "double jump running" are exactly the same (I mean, it is a single animation at any situation), I set the imagepoints in the right place for the double jump animation, cropped both sprites... I did a test attaching the flame sprite to the player box and did not notice this offset, just when attaching it to the other sprite.

Does anyone have some clue about what I'm doing wrong?
B
15
S
6
G
4
Posts: 29
Reputation: 4,782

Post » Mon Apr 30, 2012 9:43 pm

Wouldn't it be better if you put the imagepoint on the player box, instead of the sprite? This would avoid confusion and possible problems
Image
B
53
S
11
G
11
Posts: 770
Reputation: 10,810

Post » Mon Apr 30, 2012 10:45 pm

Yeah, I think that it will be the way to go for now, but the problem is that it is harder to align the sprites, since the player box is empty. Probably will need to temporarily put some of the animation frames on it to align it right. Will need to change some of logic as well, since "set mirrored" is on the player sprite, not box, and the sprite misalign when mirrored; also not sure if it is advisable to flip the colision box at all.
Just wonder if there is indeed some sort of "lagging" introduced by having multiple sprites attached to each other, or there is a right way to do that, maybe changing the logic, and I was doing it wrong.

Thanks for the feedback anyway!
B
15
S
6
G
4
Posts: 29
Reputation: 4,782

Post » Mon Apr 30, 2012 10:53 pm

The best way to do animations, is to have a box that handles all collision and other events, and then the separate sprite, that you will position on top of the box. All alignment stuff should be handled in the sprite
Image
B
53
S
11
G
11
Posts: 770
Reputation: 10,810

Post » Sat May 05, 2012 7:54 am

So, just not to leave the question open, after some tests it seems that I need to do differently than what I initially thought. Instead of spawn -> set position to object imagepoint -> destroy once used, to my case I need to pin the sprite and control it pinned. I suppose it is the correct use, so.

I've done a simple test with a red player box and two small blue boxes, the top pinned and the bottom with "set position to", the top behave as expected, always "attached" to the player box, but the lower one lags behind a little when you move, not what I wanted. Is it the way it should behave?

The test: http://dl.dropbox.com/u/3688406/pintest.capx
B
15
S
6
G
4
Posts: 29
Reputation: 4,782


Return to How do I....?

Who is online

Users browsing this forum: Levaunt and 2 guests