Can I make an Action Call For a Custom ImagePoint?

0 favourites
  • 9 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • I have this action and im trying to make my grid stick to my Masks Image Point 1 but i do not know how to call for it,at the same time keeping everything that im trying to do.

    Here is the action i need to have call for ImagePoint1

    Instead of just my default X and Y i want to set it to my custom point selected.Is there a way?

    round((Mask.X-TilesGrid.Width/2+16)/32)*32

    round((Mask.Y)/32)*32-64

  • You mean like using Mask.ImagePointX and Mask.ImagePointY ??

    For example if it's imagepoint1 your would use Mask.ImagePointX(1) and Mask.ImagePointY(1)

    Is that what you are wanting?

  • Yeah That makes more sense to me ArcadEd

    So i can replace Mask.X with Mask.ImagepointX(1) and be ok in this action right?

    Also thanks for another tip

  • That seemed to work for my grid but it also made my block creation offset.

    I put my game demo in the capX for whoever knows about this to check out.

    Im not sure if it is something in the expression or just a bug.

    In pretty sure its my end,I just want my tiles to be created where they are supposed to be and thats within the grid.

    Koolville Demo *Link Updated*

    This happens On Touched Grid

           

           Create Tile At

            round((Touch.X-16)/32)*32

            round((Touch.Y-16)/32)*32

  • Is the origin of your block in the center of it?

    I'm not sure on your math. You are basically dividing by 32 and multiplying by 32 (those 2 offset each other). Unless I am not remembering my order of operations :).

    Based on this: round((Touch.X-16)/32)*32

    Lets assume Touch.X is 59

    ((59-16)/32)*32

    ((43)/32)*32

    (1.34375)*32

    43

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ArcadEd My imagepoint is in the bottom corner,and i also have an image point that is in the middle of my block sprite.

    Im actually pretty bad with math,I can almost see in your text that its my fault but i actually just learned about "round" yesterday

    I guess my question is,If my touch position could always be different how do i make it so the block always fills the grid in a snapping fashion.

    I would rather get help than leave it messed up,I have tried a good many of number combinations but like you said my math is obvious and it is horrible.

    Thank you ArcadEd

  • There was a forum post about this not too long ago. If I remember where, I will post it.

    If your grid area is going to be that small, I would be lazy and just make invisible sprites, and when you click on it, have it spawn the block :). Invisible sprites still register collisions, like touches and clicks.

    My math isn't great either, I'll see if I can find that post.

  • There was a forum post about this not too long ago. If I remember where, I will post it.

    If your grid area is going to be that small, I would be lazy and just make invisible sprites, and when you click on it, have it spawn the block :). Invisible sprites still register collisions, like touches and clicks.

    My math isn't great either, I'll see if I can find that post.

    Awesome i hope you find that post,I would love to learn what im doing wrong.I also think you are right when it comes to using individual sprites,I started to do that at first and then got confused when it came to connecting them together around my player so i found a different route.

    Im actually curious ArcadEd on how to make all of my single sprites snap to the grid and also have them follow/pinned to my players mask.

    Thats where i got confused,and someone from the forums said to use a tiled backround but i shortly found out that there is not collision detection.

    So i have been doing alot of this for nothing and its alittle depressing but hey thats Game Dev.I hope you find something tho because i came up short when seraching for Grid Based Topics

  • I am willing to accept feedback from anyone who knows anything about this.

    Thanks in advance i think this will be a helpful thread for people making games similar to mine.

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