Programming help

Discussion in 'Programming' started by NimNom1234, Aug 18, 2018.

Tags:
  1. NimNom1234

    NimNom1234 Member

    Joined:
    Mar 31, 2018
    Posts:
    62
    I wanna make this kinda quick so

    if place_meeting(x,y+1,obj_floor) || if place_meeting(x,y+1,obj_floor_slant_up) || if place_meeting(x,y+1,obj_floor_slant_down)
    {
    falling = false
    }
    else {
    falling = true
    }

    Whats wrong with this code? I can't figure it out. Thanks :)
     
  2. Sinaz20

    Sinaz20 Member GMC Elder

    Joined:
    Aug 22, 2016
    Posts:
    150
    You only use one "if" followed by the complete expression when writing if/then conditionals:

    If (expression || expression || expression) {
    stuff
    }
     
  3. NimNom1234

    NimNom1234 Member

    Joined:
    Mar 31, 2018
    Posts:
    62
    Ah, makes sense

    Thanks!
     
  4. Sanctifier

    Sanctifier Member

    Joined:
    Aug 29, 2016
    Posts:
    22
    One thing I'd recommend is using a parent for your obstacles so that you only have to perform a check for a single object.
     
    NimNom1234 and Sinaz20 like this.
  5. NimNom1234

    NimNom1234 Member

    Joined:
    Mar 31, 2018
    Posts:
    62
    Okie dokie
     

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