Overlapping At An Offset Range

Get help using Construct 2

Post » Sat Dec 05, 2015 12:30 pm

Is there a way to include in my expression a range? etc (0,20) for the "Overlap at Offset".

I'm trying to make a customisable range of the sword swing of a 2D platformer game but the higher the offset, the further I can attack but I lose contact of the mobs closer to me.
B
8
S
2
Posts: 27
Reputation: 610

Post » Sat Dec 05, 2015 1:30 pm

Hey Nitari, :)

One possible approach, instead of using "overlapping at offset", you could use a second invisible sprite as a collision object, and stretch it wider as the sword range increases.
B
27
S
18
G
8
Posts: 327
Reputation: 6,154

Post » Sun Dec 06, 2015 2:49 am

fisholith wrote:Hey Nitari, :)

One possible approach, instead of using "overlapping at offset", you could use a second invisible sprite as a collision object, and stretch it wider as the sword range increases.



Thanks so much! I have one question though, now what's happening is that when I increase width, the box grows wider in 2 directions. I can't find an efficient way to position the box such that it protrudes out in front of the player rather than the default widening on both sides. Also, the mirroring is another issue
B
8
S
2
Posts: 27
Reputation: 610

Post » Sun Dec 06, 2015 3:11 am

You need to adjust where the origin is on your Sprite. You can do this in the image editor.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sun Dec 06, 2015 6:55 am

What you're looking for is exactly what @R0J0hound mentioned. :)


Setting the origin point
If you double click on the collision sprite object, the image editor should open.
In the image editor, on the left-hand toolbar, choose the 2nd tool from the bottom (looks like a crosshair). This is the "Set origin and image points" tool.

With this tool selected you can set the origin point of your object wherever you want. You can also use the number-pad on your keyboard to quickly snap the origin point to the center edges or corners of the sprite image, though Num-Lock must be enabled for this.

If the default images of your sword and character face rightward, then for your collision sprite, you'll probably want to put the origin point on the far left edge. You can press numpad-4 to do this, if Num-Lock is enabled.

Accept the changes and then try it out in the editor by holding down Ctrl + Shift and Dragging one of the corner resize handles on your collision object. It should now scale around the new origin point you just set.
(You'll want to undo that resize afterwards of course. Be careful not to also undo the change to the origin point.)


Flipping the sprite
As for flipping or mirroring the object, in that object's actions, in the Appearance group, you can use the "Set Mirrored" action to flip the object horizontally, and the "Set Flipped" action to flip the object vertically.


C2 Manual Page on Image Points
https://www.scirra.com/manual/63/image-points
B
27
S
18
G
8
Posts: 327
Reputation: 6,154

Post » Sun Dec 06, 2015 1:51 pm

Message: Nitari is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
fisholith wrote:What you're looking for is exactly what @R0J0hound mentioned. :)


Setting the origin point
If you double click on the collision sprite object, the image editor should open.
In the image editor, on the left-hand toolbar, choose the 2nd tool from the bottom (looks like a crosshair). This is the "Set origin and image points" tool.

With this tool selected you can set the origin point of your object wherever you want. You can also use the number-pad on your keyboard to quickly snap the origin point to the center edges or corners of the sprite image, though Num-Lock must be enabled for this.

If the default images of your sword and character face rightward, then for your collision sprite, you'll probably want to put the origin point on the far left edge. You can press numpad-4 to do this, if Num-Lock is enabled.

Accept the changes and then try it out in the editor by holding down Ctrl + Shift and Dragging one of the corner resize handles on your collision object. It should now scale around the new origin point you just set.
(You'll want to undo that resize afterwards of course. Be careful not to also undo the change to the origin point.)


Flipping the sprite
As for flipping or mirroring the object, in that object's actions, in the Appearance group, you can use the "Set Mirrored" action to flip the object horizontally, and the "Set Flipped" action to flip the object vertically.


C2 Manual Page on Image Points


Thanks so much! The origin part was a lifesaver, if only i could give you real cookies XD
B
8
S
2
Posts: 27
Reputation: 610


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, Yahoo [Bot] and 5 guests