object fall with alarm

Discussion in 'Programming' started by kasm15, Apr 15, 2019.

  1. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    hi

    i am making a platfrom game and wanted to make if the player hit the a object it change instance and it fall dawn
    and it don't work it simply dn't change instance

    script:

    [​IMG]


    [​IMG]

    any tip
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,436
    Does your player have a collision event with fall1 or oParSolid already?
     
  3. TheSly

    TheSly Member

    Joined:
    Jan 16, 2017
    Posts:
    801
    Firstly, I suggest you give your sprites and objects names that describe the items. It helps you and others debug your code.
    Secondly, what is in oParSolid and the step event that might effect the change?
     
  4. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    it have a collison event with fall1
     
  5. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    step event is really empty black script page and oParSolid is empty elsoit defened the soild ground and wall as soild
     
  6. TheSly

    TheSly Member

    Joined:
    Jan 16, 2017
    Posts:
    801
    So player has a collision event with fall1, and fall1 also has a collision event with player. You only need 1 collision event, pick one object and have the collision event in one of them only.
     
  7. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    did same same issue
     
  8. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,436
    If this is in Game Maker Studio, move fall1 up in the resource tree so that it is above oPlayer. Then test your code. If this is GM8, it won't work that way.


    So here's the thing we're trying to get at, which in similar situations is the root of the problem:

    fall1 is a child of oParSolid. Inside fall1 is a collision event with oPlayer that should be telling fall1 to turn into object284 (your falling platform). Collisions are checked in the order of objects in the resource tree. So if oPlayer had a collision event with fall1 or a collision event with oParSolid, it would be run first and then you would (presumably) move oPlayer outside the collision. So then when it's ofall1's turn to run its collision event code, there is no longer a collision because oPlayer's collision event code already moved it out of the collision.

    Update: Don't make fall1 a child of oParSolid. See if the code works that way. If it does, then it's oPlayer's collision with oParSolid getting run before fall1's that is causing the issue.
     
  9. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    i Don't make fall1 a child of oParSolid and work great thanks
     
  10. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    but now other issue the object not soild and the player can went in it
     
  11. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,436
    Yes, because the player was handling his oParSolid collisions first. You could try making fall1 stop the player before changing.
     
  12. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63
    how to do that
     
  13. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,436
    What do you have for oPlayer's collision with oParSolid? And is it in drag&drop or in GML?
     
  14. kasm15

    kasm15 Member

    Joined:
    Jan 16, 2017
    Posts:
    63

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