How do I Connect Two Image Points from Different Objects?

Get help using Construct 2

Post » Mon Sep 01, 2014 8:02 pm

I have two sprites, each one with some ImagePoints.

I can get to connect the Origin Point of one to the Image Point of the other.


But can I get to connect the ImagePoint 1 of one Sprite to the ImagePoint 2 of the other one?


Thanks in advance!
B
4
Posts: 12
Reputation: 218

Post » Mon Sep 01, 2014 8:23 pm

Use:
sprite1.imagepointx(1), sprite1.imagepointy(1) sprite2.imagepointx(2),sprite1.imagepointy(2)

To get the x and y values of the imagepoints..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 02, 2014 3:26 am

@LittleStain I think he is asking whether it is possible to [action:set position] using imagepoints instead of origin, which I think can't be done unless using a mathematical workaround.

@NicholasMDS if it is important to use the imagepoints, then you have to get the x's and y's for the sprites and manually build a mathematical equation to position it correctly. You can start with what LittleStain showed above.

Maybe it's a good idea to request [action: set imagepoint position to object] as a new feature, don't you think? I see a lot of use in it.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Tue Sep 02, 2014 6:28 am

You could be able to do this with something like this:

' Set sprite1 origin to sprite2 imagepoint
Set sprite1 position to sprite2.imagepoint(1).x, sprite2.imagepoint(1).y

' Move sprite1 so that instead of origin we get the imagepoint at the spot we want
Set sprite1.x to distance(sprite1.x, 0, sprite1.imagepoint(1).x, 0)
Set sprite1.y to distance(sprite1.y, 0, sprite1.imagepoint(1).y, 0)

Something like that, formulas might be wrong (and can be simplified) as I did not test it but the idea should work. :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Tue Sep 02, 2014 9:23 pm

Thank you guys for your posts
.
@vee41 That's a good idea, but I coudn't find a way to "set sprite1 origin to...". But there must be a way of doing it!
@DuckfaceNinja Agreed. That would be a great addition to Construct 2. Maybe if we send this idea to them, they can hear us! Ashley is the girl, right?

What I've done to solve my problem is: When I need to compare the two different ImagePoints, I call an animation identical to the other one, but with the Origin Point positioned where I need. It worked out greatly for my purposes.
B
4
Posts: 12
Reputation: 218

Post » Wed Sep 03, 2014 3:36 am

NicholasMDS wrote:Ashley is the girl, right?

Sir, you made my day :D

[Set sprite1 origin to] is actually the default for [action: Set position].

Adding a feature like most probably useful for games that uses a lot of sprite i'e multi turret or just simply a skeletal animation without using spriter. Using spriter will be much faster but, it might be interesting to be used with physic though. These can already be done through math, but it would be much simpler in terms of structuring the events and visually easier to be used by beginners or somebody who not that excel at math.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Wed Sep 03, 2014 4:05 am

It would be handy in a situation where you had a spaceship for example, with many parts that you could build onto it, and to add more and more pieces upon pieces like lego. If you had a long rectangular piece for example, and wanted to attach it to the ship's hull, but then also have another piece on the end. And also wanted to be able to rotate that piece around to any angle.

The only other way around i could see would be to have an invisible helper object, and make each piece a child of that helper object.
B
90
S
44
G
17
Posts: 1,012
Reputation: 18,527

Post » Wed Sep 03, 2014 5:06 am

justifun wrote:The only other way around i could see would be to have an invisible helper object, and make each piece a child of that helper object.

Totally agreed! Using imagepoints might be the key in reducing numbers of "helper object" or probably eliminate the need to use them, thus reducing file size and increase performance and whatnot.

I think it's worthwhile to ask @Ashley to have a look at this idea.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924


Return to How do I....?

Who is online

Users browsing this forum: Semoreh and 6 guests