Create instance when in a certain area

Discussion in 'Programming' started by Just a game programmer, Dec 16, 2018.

  1. Just a game programmer

    Just a game programmer Member

    Joined:
    Apr 10, 2017
    Posts:
    25
    Hi everyone. In my game, the player has to drop an item when in a specific zone. Is there any way for me to code that the player can drop the item only when in a specific zone,i.e when touching an object? Thanks!
     
  2. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,185
    You have your usual collision functions like place_meeting and the such.
    Code:
    if (place_meeting(x, y, obj_zone))
    {
      // drop code
    }
    
    or use the collision event with obj_zone and write your drop code there.
     
  3. Just a game programmer

    Just a game programmer Member

    Joined:
    Apr 10, 2017
    Posts:
    25
    Thanks!
     

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