AnD4D's Recent Forum Activity

  • I need to stop posting text versions of events I guess. Here's what I posted implemented in events. Does that work?

    https://www.dropbox.com/scl/fi/7skmhfwidcf0ygdqucsp3/oval_to_oval.capx?rlkey=lcin8s5rnwye32cgabzokbdd5&st=rcnta4d9

    Sorry for the late reply! I ended up doing it step-by-step like in the image. Seems to work the same but with better scaling control.

    Not sure which approach is actually better though. Thoughts?

  • Your example disappeared. It should be reversible, but it’s been a bit so let’s redo it from scratch.

    To setup you’d have four objects: oval0, cur0 on layer0, and oval1 and cur1 on layer1. It shouldn’t matter the scale,rotation or rotation of the objects, layer or layout.

    Now let’s suppose you want the mouse position on an oval on one layer to be mapped to an oval on another. We can do that with four set position actions.

    Cur0: set position to mouse(0).x, mouse(0).y
    
    Cur1: set position to cur0.x-oval0.x, cur0.y-oval0.y
    
    Cur1: set position to (self.x*cos(oval0.angle)+self.y*sin(oval0.angle))/oval0.width*oval1.width, (self.x*cos(oval0.angle+90)+self.y*sin(oval0.angle+90))/oval0.height*oval1.height
    
    Cur1: set position to oval1.x+self.x*cos(oval1.angle)+self.y*cos(oval1.angle+90), oval1.y+self.x*sin(oval1.angle)+self.y*sin(oval1.angle+90)

    It should work mapping from any layer to any other layer. The idea here is we get the xy relative from one oval and then calculate the xy relative to another.

    That's odd, sorry about that. I updated the link, so hopefully it works now, and here it is just in case:

    https://1drv.ms/u/c/45d17dca4e466456/EYqQ_BcI_F5FqvgRKA06wbIBj0gJxOZAjfEB-AJU12qdzw?e=lQ9gMs

    I'm still having issues with the different layers.

  • It was great seeing so many games on the new video Scirra recently shared.

    Quite a few games I never knew were made with Construct. Congrats!

    Missed Temporian though ;)

    Wouldn't have been able to do this without Construct 3. So a massive thank you to the team and this community!

    Time to check out those other games!

  • Since you mentioned rotation, here is an example of one way to do it that handles either oval being rotated. And as mentioned in the previous post it is completely independent of view scale, scrolling or rotation. The math is done across three actions to be more readable since combining it into one formula isn't very pretty. The trig functions are just used to rotate the xy position.

    https://www.dropbox.com/scl/fi/f30qzkjny5nl2fed85udn/map_map_to_layout.capx?rlkey=jz3bnfrrrfxqca247o12ibprp&st=bffq95ky

    R0J0hound I feel I may have pushed this to its limits.

    I'm working with this in my project, but now I need to have the map on a HUD that never moves and never scales.

    The second I change it, everything misaligns.

    I've spent the last few days trying to get this to work, and I'm afraid I can't figure it out.

    Is there any chance you can have a quick look? You may be able to spot what I'm missing.

    https://1drv.ms/u/c/45d17dca4e466456/EYqQ_BcI_F5FqvgRKA06wbIBj0gJxOZAjfEB-AJU12qdzw?e=lQ9gMs

    *Edit - I've updated it. I can get it working one way, but not the other. Reversing this code is... hard.

  • igortyhon I appreciate you trying to help, but your response seems to have missed the actual question and then criticized my tone rather than addressing the technical issue.

    The original post I linked was specifically about autotiling and runtime tile placement ('I recently discovered that you can tell construct to place tiles using the tilemap paintbrush during runtime'). My question was about this same functionality - being able to rotate/flip tiles while maintaining their autotile behavior during runtime placement. The standard rotation tools you're referring to break autotiling (as I mentioned, when I try to rotate, it reverts to the top-left tile).

    I realize my question about why this hasn't been implemented might have come across as critical, but that wasn't my intent. I was genuinely curious if there were technical reasons or if I was missing something, which is why I said 'I can only assume I'm missing something.'

    Rather than assuming I haven't checked the engine updates or questioning my approach, it would be more helpful to either provide a solution to the autotiling issue or acknowledge if you're not familiar with that specific functionality.

    If you have insights on achieving rotated autotiles during runtime placement specifically, that would be genuinely helpful.

  • 3 years ago, someone asked this:

    https://www.construct.net/en/forum/construct-3/how-do-i-8/rotatemirror-tile-tile-brush-173593

    Was there any update to that? It seems obvious that something like that is a useful feature, and I can't quite understand why it's not possible. I can only assume I'm missing something.

    Say I have this tilemap. I only want half tiles to line a corridor. At the moment, I can only line the top and left walls. The right and bottom tiles would come away from the walls.

    This could be fixed with a simple flip or rotate state... but when I try to do that, it becomes the tile in the top left.

    Can anyone tell me why after 3 years, such a simple addition hasn't been made?

  • Since you mentioned rotation, here is an example of one way to do it that handles either oval being rotated. And as mentioned in the previous post it is completely independent of view scale, scrolling or rotation. The math is done across three actions to be more readable since combining it into one formula isn't very pretty. The trig functions are just used to rotate the xy position.

    https://www.dropbox.com/scl/fi/f30qzkjny5nl2fed85udn/map_map_to_layout.capx?rlkey=jz3bnfrrrfxqca247o12ibprp&st=bffq95ky

    Wow! This is impressive! It works with scale and scrolling. That is remarkable. Thank you!

    I'm going to have to spend some time studying this. Love it!

  • This is an example and it would be more convenient for me to do it through variables than to directly insert the parameters of objects into the formula.

    You didn't say anything about the scrolling, you only talked about the scale.

    Don't get me wrong, I appreciate the help, but what I essentially said was "How do I get this current version of my program to work with scale."

    It's like if I was making a platformer, and asked "How do I make him jump?" and you add in the jump, but remove the ability to walk.

    Again, as I said, I appreciate the attempt, but I'd have thought it's implied that I didn't want the other features of the program removed.

    Not to worry, thanks again for the help :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this:

    -> OffScreenMouse: Set position to (lerp(SmallScreen2.BBoxRight, SmallScreen2.BBoxLeft, unlerp(SmallScreen.BBoxTop, SmallScreen.BBoxBottom, LayerToLayerY(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y))), lerp(SmallScreen2.BBoxTop, SmallScreen2.BBoxBottom, unlerp(SmallScreen.BBoxLeft, SmallScreen.BBoxRight, LayerToLayerX(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y))))

    > {"is-c3-clipboard-data":true,"type":"actions","items":[{"id":"set-position","objectClass":"OffScreenMouse","parameters":{"x":"lerp(SmallScreen2.BBoxRight, SmallScreen2.BBoxLeft, unlerp(SmallScreen.BBoxTop, SmallScreen.BBoxBottom, LayerToLayerY(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y)))","y":"lerp(SmallScreen2.BBoxTop, SmallScreen2.BBoxBottom, unlerp(SmallScreen.BBoxLeft, SmallScreen.BBoxRight, LayerToLayerX(OnscreenMouse.LayerName, SmallScreen.LayerName, OnscreenMouse.X, OnscreenMouse.Y)))"}}]}
    

    This works perfectly, no matter the scale and the scroll. Impressive.

    I don't understand how the magic is working, because I don't understand lerp and unlerp, but it does work no matter what I throw at it. Tempted to add rotation to it to see if it continues to work :D

    I wonder if this is the simplest way to do it. Rojo's words seem to suggest I've overcomplicated things. I try to avoid using variables, and this seems smart, but I'm going to have to sit down and tinker with it to better understand it.

    Thank you.

    Edit - Rotation does indeed break it XD But that wasn't what I was trying to learn, so it's still perfect.

  • I don't know why your map has a different shape than the surface and I don't understand why the actions on the map are inverted along the coordinate axes. Perhaps something happened to your hero in the story.

    I tried to make a simple example.

    https://fex.net/s/73anrpo

    Lol, yeah, our hero has problems XD

    This worked well for scale, but I note you added in a lot of variables and disabled the scrolling aspect of my code. The moment I put that back in, your version stopped working :(

  • So the black oval is like a scaled version of the screen rotated 90 degrees, and you want the mouse over that to translate to a position over the view?

    Let’s try and simplify it a bit first. If you make the oval not rotated and move the origin to the center then the calculated xy position on the view would be:

    (Mouse.x(1)-oval.x)/oval.width*viewportWidth(0)+scrollx

    (Mouse.y(1)-oval.y)/oval.height*viewportHeight(0)+scrolly

    Note: mouse.x(1) is the mouse position on the hud layer.

    Now let’s make it work if the oval is rotated 270 degrees like you have. Basically (x,y) rotated -90 will become (y,-x), but you have it vertically flipped (y,x). So swapping things around a bit the xy formulas will be:

    (Mouse.y(1)-oval.y)/oval.width *viewportWidth(0)+scrollx

    (Mouse.x(1)-oval.x)/oval.height *viewportHeight(0)+scrolly

    I'm afraid I struggled to follow this. I ended up with:

    {
     "is-c3-clipboard-data": true,
     "type": "events",
     "items": [
     {
     "eventType": "block",
     "conditions": [
     {
     "id": "every-tick",
     "objectClass": "System"
     }
     ],
     "actions": [
     {
     "id": "set-position",
     "objectClass": "OffscreenMouse",
     "parameters": {
     "x": "((OnscreenMouse.Y - SmallScreen.Y) / SmallScreen.Width) * ViewportWidth(0) + ScrollX",
     "y": "((OnscreenMouse.X - SmallScreen.X) / SmallScreen.Height) * ViewportHeight(0) + ScrollY"
     }
     }
     ]
     }
     ]
    }
    

    which didn't work. I'm assuming I did something obvious wrong.

  • I want to be able to interact with my world while using a mini-map.

    I've attached an example showing what I'm aiming for. It all works fine at 1x scale, but the moment I try something else, everything breaks.

    Can anyone have a look at this code and let me know what I'm doing wrong?

    https://1drv.ms/u/c/45d17dca4e466456/EW2nb7BZfLZAleIZ3m_iZo4B6Tze1yNAjJ7SFCeAFNLrUQ?e=qFLbR1

AnD4D's avatar

AnD4D

Member since 4 Nov, 2011

Twitter
AnD4D has 4 followers

Connect with AnD4D

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x3
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

22/44
How to earn trophies