GML Collision anyone?

Discussion in 'Game Design' started by Pixel81, Aug 11, 2017.

  1. Pixel81

    Pixel81 New Member

    Aug 11, 2017
    Likes Received:
    So I am making a game in GML ( Game Maker Language ) where you a little rectangle with a sword in a maze. Enemies will come to you with life points and you will use your sword to kill them. The goal of the game is to get as many kills as possible before dying. I have done quite a bit so far but have had troubles with collision detection with the wall. My movement code for the player is:

    (player object)
    /// Exacute movement script
    step event: scr_movement_player();

    (script scr_movement_player)


    // Variables
    up = keyboard_check(ord('W'));
    down = keyboard_check(ord('S'));
    left = keyboard_check(ord('A'));
    right = keyboard_check(ord('D'));

    // Movement

    if(right) x += 7;
    if(left) x -= 7;
    if(down) x += 7;
    if(up) x -= 7;

    I've looked all over youtube to find any collision code but can't find any.

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer