1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Looking for the meaning inside code (Yoyo Brick Breaker Demo)

Discussion in 'Programming' started by dannyyplau, May 15, 2019 at 11:41 AM.

  1. dannyyplau

    dannyyplau Member

    Joined:
    Apr 10, 2017
    Posts:
    2
    I am new for the GML. I have tried to read the code in Yoyo Brick Breaker Demo.

    I have see this code in the script "ClearBlock":

    ...
    var count = global.hits[# argument0>>5,argument1>>4]-1;
    ...

    I have no idea what happened if it use shift operator (>>) for argument0 and argument1,
    And the # symbol, I have tried to search its meaning in help file but cannot find.

    May someone know and kindly advise? Thank you.
     
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,246
    a[#b, c] is shorthand for ds_grid_get(a, b, c)

    (a >> b) is roughly the same as floor(a / power(2, b)) - so, in this case, it divides coordinates by 32 and 16 accordingly. A bit faster, but in most games you don't have to worry about such small details.
     
  3. dannyyplau

    dannyyplau Member

    Joined:
    Apr 10, 2017
    Posts:
    2
    Thanks for your advise.
     

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