Hotline Miami Remake in GameMaker Studio #34 - Rotation fix

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии • 12

  • @willm127
    @willm127 5 часов назад +1

    Oh heck yeah, we're back!

  • @ajinkyax
    @ajinkyax 5 часов назад +1

    Wow what a great topic and such a great contribution to GameMaker community

    • @1upIndie
      @1upIndie  4 часа назад

      Thanks (and for watching)!

  • @1upIndie
    @1upIndie  6 часов назад +1

    Script code from this video:
    new + much easier code by TheJevonjames:
    var _lerp_speed = 0.1; // how fast to rotate
    image_angle_ -= angle_difference(image_angle_, direction) * _lerp_speed;
    //// old code:
    var angleSet = image_angle_;
    var faceMinus = abs(image_angle_ - direction);
    if( faceMinus > 180 ){

    if( image_angle_ > direction ){ angleSet = -1 * ((360 - image_angle_) + direction); }
    else { angleSet = (360 - image_angle_) + direction; }

    }

    angleSet = clamp(angleSet, 0, 359);


    image_angle_ = lerp( angleSet, direction, 0.1 );

  • @SKumarInTech
    @SKumarInTech 6 часов назад +1

    i brought your course mam, you should update it

    • @1upIndie
      @1upIndie  4 часа назад

      You mean my Udemy course?

  • @TheJevonjames
    @TheJevonjames Час назад +1

    there's a better way to do this
    instead of doing image_angle_ = lerp(image_angle_, direction, 0.1)
    do
    var _lerp_speed = 0.1
    image_angle_ -= angle_difference(image_angle_, direction) * _lerp_speed

    • @1upIndie
      @1upIndie  Час назад

      Not sure I get what the other code means. Is it another way to do the lerp code or the "full" way to do the rotation?

    • @TheJevonjames
      @TheJevonjames Час назад

      @@1upIndie it lerps to the target angle, but it will always take the shortest route to reach the target angle, instead of doing a full spin when using lerp

    • @1upIndie
      @1upIndie  Час назад

      @@TheJevonjames Damn, just checked this code. It is short, more efficient and more elegant. Thanks, but that makes my video pointless :D

    • @TheJevonjames
      @TheJevonjames Час назад +1

      @ it’s always good to learn new ways of doing stuff and may make more sense to newbies, so the video does its job! And gives a good platform for my comment to share other ways. You’re doing a great job, keep it up ✌🏻

    • @1upIndie
      @1upIndie  30 минут назад

      @@TheJevonjames 100% agree here! Thanks for showing me the actually easy way.