PRO | Mich hauts aus dem Spiel raus =(

  • GM 7

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • PRO | Mich hauts aus dem Spiel raus =(

    Hi!
    Ich hab da noch ein Problem:
    Also, in meinem Game da gibt es eine Multiplayer (Nicht Online ^^) Modus, bei dem es 2 verschiedene Charaktere gibt!
    So, nun mein Problem:
    Es gibt einen kleinen Mario, und einen großen Mario, einen kleinen Luigi und auch einen großen Luigi!
    So, wenn jetzt z.B. der kleine Luigi den kleinen Mario besieg, hauts mich einfach aus dem Spiel raus!
    Ja, ich habe "Display Error Messages" an!
    Und unter Scripts -> "Check Resource Names" steht "No errors were found"
    Weiß einer von euch, woran das noch liegen könnte?
    Oder hat der irgendein Problem? Denn wenn der große Mario den kleinen Luigi besiegt, geht alles perfekt, nur wenn der kleine Mario den kleinen Luigi besiegt, kackt das spiel ab! ?(
    fabse64 -> haiyyu
  • Das Spiel beendet sich einfach!
    Code ist da:

    obj_mario_small_mplay (mplay ist einfach damit ich erkenn dass es der Multiplayer Mario ist ^^)

    GML-Quellcode

    1. Destroy Event:
    2. for all obj_xory_par_mplay: destroy the instance
    3. for all obj_luigi_small_mplay: change the instance into object obj_luigi_small_won, yes performing events
    4. for all obj_luigi_big_mplay: change the instance into object obj_luigi_big_won, yes performing events
    5. Step Event:
    6. execute code:
    7. if(global.mariohealth<1)
    8. {
    9. instance_change(obj_mario_died_mplay,1)
    10. }
    Alles anzeigen


    obj_luigi_small_mplay

    GML-Quellcode

    1. Destroy Event:
    2. for all obj_xory_par_mplay: destroy the instance
    3. for all obj_mario_small_mplay: change the instance into object obj_mario_small_won, yes performing events
    4. for all obj_mario_big_mplay: change the instance into object obj_mario_big_won, yes performing events
    5. Step Event:
    6. if(global.luigihealth<1)
    7. {
    8. instance_change(obj_luigi_died_mplay,1)
    9. with(obj_mario_small_mplay)
    10. {
    11. instance_change(obj_mario_small_won,1)
    12. }
    13. with(obj_mario_big_mplay)
    14. {
    15. instance_change(obj_mario_big_won,1)
    16. }
    17. with(obj_xory_par_mplay)
    18. {
    19. instance_destroy()
    20. }
    21. }
    Alles anzeigen


    Das ist der wichtigste Teil!
    fabse64 -> haiyyu
  • Yup ok!
    Also:
    obj_mario/luigi_small/big_won

    Quellcode

    1. Information about object: obj_mario_small_won
    2. Sprite: spr_mario_small_won
    3. Solid: false
    4. Visible: true
    5. Depth: 0
    6. Persistent: false
    7. Parent: <no parent>
    8. Mask: <same as sprite>
    9. Create Event:
    10. set Alarm 0 to 200
    11. Alarm Event for alarm 0:
    12. restart the current room with transition effect Blend
    13. Step Event:
    14. if relative position (0,1) is collision free for Only solid objects
    15. set the gravity to 0.25 in direction 270
    16. else
    17. set the gravity to 0 in direction 270
    18. Collision Event with object obj_solidpar:
    19. set the vertical speed to 0
    Alles anzeigen


    obj_mario/luigi_small/big_died

    Quellcode

    1. Information about object: obj_luigi_died_mplay
    2. Sprite: spr_luigi_died
    3. Solid: false
    4. Visible: true
    5. Depth: 0
    6. Persistent: false
    7. Parent: <no parent>
    8. Mask: <same as sprite>
    9. Create Event:
    10. set the vertical speed to -5
    11. Step Event:
    12. set the gravity to 0.25 in direction 270
    Alles anzeigen


    Das wars xD
    fabse64 -> haiyyu
  • Das Problem ist ganz simpel: Wenn Mario zerstört wird zerstört er auch Luigi, wodurch dessen Destroy Event aufgerufen wird, wodurch er versucht Mario zu zerstören, was dessen Destroy Event wiederum aufruft => Es _würde_ eine Endlosschleife entstehen, doch der GM bemerkt das und beendet das Spiel.
    Du musst im Destroy Event prüfen ob dieses Event schon mal ausgeführt wurde (-> Variable) und falls dies der Fall ist, das Event mit exit; unterbrechen.

    mfg Dragoon
    int (*x(*x(int))[5])(int*);
    Confused? Yes, it's C!