How do I Connect Two Image Points from Different Objects?

0 favourites
  • 8 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • 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!

  • Use:

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

    To get the x and y values of the imagepoints..

  • 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.

  • 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.

  • 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.

  • Ashley is the girl, right?

    Sir, you made my day

    [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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

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