1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

GM:S 1.4 whats a slow speed in code

Discussion in 'Programming' started by guywithglasses, Oct 20, 2019.

  1. guywithglasses

    guywithglasses Member

    Joined:
    Oct 20, 2019
    Posts:
    4
    ive been trying to get a speed that is slow, in code but i never get the right speed.
    i tried image_speed = 0.1
    and image_speed = 0.25

    and more. but i never got the right speed.
    Please help :)
     
  2. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    What's your room speed? If it's 30, speeds are half as fast as if it's 60. Speeds are relative, there's no speed values that are intrinsically fast or slow... it depends of all the other factors of the game.
     
  3. Tirous

    Tirous Member

    Joined:
    Jun 21, 2016
    Posts:
    75
    In GameMaker, time is processed in discrete units known as "frames", with the amount of these frames passing per second being equal to the "room_speed" of the game at that time (don't ask what happens when you change room_speed mid-game, it's incredibly stupid yet also mostly harmless.)

    All, or at least most, things that measure time count frames, so an image_speed of 1 means that it changes one image every frame, if you room_speed is 30, then it will change 30 times per second.

    An image_speed of 0.5 will mean it will change 50% to the next image over one frame, what this means in practice is that it will sit on an image index for two frames before moving to the next, with this being due to the fact that when GameMaker actually picks which image to display, it does so by taking the image index and rounds it down to the nearest integer, thus you get the values 0, 0.5, and 1, becoming 0, 0, and 1, in practice, thus causing the wait.

    This frame counting extends to all aspects of GameMaker. If you make an object move rightwards at a pace of 3, that means it's moving 3 units EVERY FRAME, and thus will move at exactly a rate of 3 * room_speed units per second.

    It's a tad confusing at first, but it's important you get a solid understanding for this concept if you want to use GameMaker effectively. And especially if you want to go onto using other more complex engines like Unity and maybe even making your own custom game engine in something like C++, this is one of those pieces of knowledge that will only become more important to have as you progress.

    That said, if my answer isn't clear enough for you, just say so, I'd be more than happy to ramble on with a few more examples if need be. :)
     
    DaMuffin likes this.
  4. guywithglasses

    guywithglasses Member

    Joined:
    Oct 20, 2019
    Posts:
    4
    thanks i did not know that, i will do that
     

Share This Page