Using Surfaces in GameMaker Studio 2 for Reflections

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 22

  • @dongn405
    @dongn405 4 роки тому +2

    this is a fantastic tutorial. had some issues due to my sprites being Middle-Center by default but quickly noticed and fixed. thank you!

  • @neerajbalani6737
    @neerajbalani6737 4 роки тому +3

    i don't want it to reflect everything. i only want to reflect my 'player' layer. is that possible? thanks in advance

  • @1upIndie
    @1upIndie 3 роки тому +2

    Good video. How would you change your code once you have a camera zoom (different viewport values then camera values) because this pretty much messes up the whole concept shown here.

    • @GameMakerCasts
      @GameMakerCasts  3 роки тому +3

      There will be a bunch of assumptions here. So say you are zooming and then setting the camera with
      camera_set_view_size(camera, camera_width, camera_height);
      Then what you would be doing, is checking for the change of camera_width or camera_height (or mouse scroll, etc).. Once you have detected a change, then you simply change the application surface size. So in 2.3 I would have a "resize" function on my camera object that would handle everything.
      resize = function() {
      camera_set_view_size(camera, camera_width, camera_height);
      if(surface_exists(application_surface)) {
      surface_resize(application_surface, camera_width, camera_height)
      }
      }
      Once your application surface is resized the values still work without having to figure out ratio and a bunch of math. Otherwise when you scroll in, your "zoom" (camera width/height) is now different than your application surface. And you have to apply some math to get the right coordinates.

  • @ibaisanchez3230
    @ibaisanchez3230 7 місяців тому +1

    Hello, good video, I had a problem when drawing the reflection, the "application_surface" variable only copies the background, the player object omits it.
    what could be happening?

    • @Schaschlik7
      @Schaschlik7 6 місяців тому

      Try running the code in the post draw event

  • @onyourpocket8642
    @onyourpocket8642 4 роки тому +1

    Fantastic tutorial help me a lot tks

  • @y0g_s0th0th
    @y0g_s0th0th 4 роки тому +1

    This is amazing. What should I do if the reflective surface is a mirror and want to change the hue of the reflection or reflect a different game object?

    • @GameMakerCasts
      @GameMakerCasts  4 роки тому +2

      You would need to apply a shader to the object that is doing the drawing. Basically you will end up wrapping the "draw_surface_ext" in a shader. Make any sense?

    • @y0g_s0th0th
      @y0g_s0th0th 4 роки тому

      GameMaker Casts yes!!! You’re fucking awesome. Thank you

  • @arthas2
    @arthas2 3 роки тому

    Awesome. Can you reflect the tiles?

  • @chutney88
    @chutney88 3 роки тому +2

    Don't know what I'm doing wrong but I can't get this to work at all. I've triple checked my code against yours and it is identical. I also double checked those first steps with the variable definitions and they are the same too. It's frustrating because your technique looks like exactly what I need! When I put the objects in my real game room I get a weird reflection of what looks like a bunch of vertical lines. Whereas if I use an almost empty room like your example (with just my player and the reflection objects) I get no reflection at all!

    • @GameMakerCasts
      @GameMakerCasts  3 роки тому

      I could take a look at your project if you want? Just upload it to dropbox or something and I'll have a look (or PM me on discord)

    • @fakhrulhilmi9698
      @fakhrulhilmi9698 3 роки тому +2

      hello, i actually had the same problem with you. have u fixed it yet?. i swear everything is identical but its still not working

  • @darkfr1drix931
    @darkfr1drix931 2 роки тому

    can i use that on topdown RPG?

  • @sonshadsilver2138
    @sonshadsilver2138 3 роки тому +2

    Hi, I tried this tutorial and I am getting things to reflect but the reflection ends up being bigger than the part it captures. Is there a way to fix this?

    • @sonshadsilver2138
      @sonshadsilver2138 3 роки тому +1

      Another thing, it's not capturing what ever is at the capture target. It seems to be capturing something else and I don't know why.

    • @chutney88
      @chutney88 3 роки тому +1

      @@sonshadsilver2138 I have the same issue!

    • @ExzoDev
      @ExzoDev 3 роки тому +1

      Did any of you guys get it fixed?

    • @Welvex.
      @Welvex. 2 роки тому

      I am still waiting for an answer :(

  • @Welvex.
    @Welvex. 2 роки тому +1

    ok, I was trying several things and I realized that it only works relative to the camera and the room, so if my camera follows the player the reflection is damaged, if my room is bigger than my camera it is also damaged or if I want to apply it to other rooms it is completely damaged, so my final conclusion is that this tutorial is only useful for a specific situation, therefore to achieve the effect I want it has to be in another way, if someone can help me to make a reflection that remains static and that is independent of the camera I would greatly appreciate it...

    • @GameMakerCasts
      @GameMakerCasts  2 роки тому +2

      Try this one then: ua-cam.com/video/bPnl4DpiCl0/v-deo.html With the introduction of layers and effects you can get around all the hard work, and that one doesn't rely on a static camera