GM:S 1.4 Rotating tiles with code?

Discussion in 'Programming' started by Fixer90, Dec 22, 2017.

  1. Fixer90

    Fixer90 Member

    Joined:
    Nov 17, 2016
    Posts:
    142
    Title says it all. Can tiles be rotated with code, even unconventionally?
    Code:
    var ground = tile_get_ids_at_depth(1000010);
    
    for(var g = array_length_1d(ground), n = 0; n < g; n ++)
    {
        tile_set_rotation_oh_wait_this_function_doesnt_exist_darn_it(ground[n], choose(0, 90, 180, 270));
    }
    NOTE: This is in the Room Start event in a persistent object.
     
    Last edited: Dec 22, 2017
  2. jo-thijs

    jo-thijs Member

    Joined:
    Jun 20, 2016
    Posts:
    2,844
    In GM:S 1.4, this does not seem to be possible.
    It is possible in GM:S 2 and you can also use your own tricks in GM:S 1.4.
    You can create 4 backgrounds, all containing the same tiles at the same positions, but have them rotated.
    You would then create a script that rotates tiles by changing the background index.
    If you're very consistent with applying this technique to all your backgrounds, you can even make this script to be 1 line.
     
    Fixer90 likes this.
  3. Edmanbosch

    Edmanbosch Member

    Joined:
    Jan 6, 2017
    Posts:
    180
    If you're using GMS2 tile_set_rotate could be what you're looking for.
     
    Fixer90 likes this.
  4. jo-thijs

    jo-thijs Member

    Joined:
    Jun 20, 2016
    Posts:
    2,844
    tile_set_rotate in combination with tile_set_mirror and tile_set_flip.
    However, this thread is tagged GM:S 1.4, so they're probably not using GM:S 2.
     
    Edmanbosch and Fixer90 like this.
  5. Dmi7ry

    Dmi7ry Member

    Joined:
    Jun 24, 2016
    Posts:
    481
    GMS1.x has tile_set_scale, but it requires two tiles instead of one (0° and 90°).
     
    Fixer90 likes this.
  6. jo-thijs

    jo-thijs Member

    Joined:
    Jun 20, 2016
    Posts:
    2,844
    True!
    That would reduce the amount of required backgrounds, but would make the rotating scripts a bit more complex.
     
    Fixer90 likes this.
  7. Fixer90

    Fixer90 Member

    Joined:
    Nov 17, 2016
    Posts:
    142
    Luckily I already found a way to do it, but only to 0, 90, 180, and 270 degrees. Thanks for all the replies!
     
  8. Steneub

    Steneub Member

    Joined:
    Jun 3, 2019
    Posts:
    10
    How did you do it?
     
  9. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,460
    Set different combinations of the tile's x and y scales. Not QUITE the same as rotating it, but close enough.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice