Health

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

  • Die suchergebnisse haben nix gebracht und das in der anleitung check ich nich.

    Wie mach ich ne healthbar, die auch angezeigt wird?
    Ich bin noch neu im Forum und im Game Maker. Seid bitte nicht so streng. :|
  • Kannste vielleicht mal die Hilfe lesen? Da stehen solche Kleinigkeiten nämlich drin.

    Draw Health
    With this action you can draw the health in the form of a health bar. When the health is 100 the full bar is drawn. When it is 0 the bar is empty. You indicate the position and size of the health bar and the color of the bar and the background.
    draw_healthbar(x1,y1,x2,y2,amount,backcol,mincol,maxcol,direction,showback,showborder)

    With this function you can draw a healthbar (or any other bar that indicates some value, like e.g. the damage). The arguments x1, y1, x2 and y2 indicate the total area for the bar. amount indicates the percentage of the bar that must be filled (must lie between 0 and 100). [...]
  • falsch henrik, dann spielt es ja tausend mal den Sound ab, das will er so nicht.

    Du musst dafür ne Varialbe machen, z.b. Alarmton, den setzt du auf 0

    GML-Quellcode

    1. //Step-Event
    2. if healt <= 20
    3. {if alarmton == 1
    4. {alarm[0] = room_speed*5; alarmton = 0;}}
    5. else {alarmton = 1;}



    GML-Quellcode

    1. //Alarm0
    2. sound_play(sound);
    3. if healt <= 20
    4. {if alarmton == 1
    5. {alarm[0] = room_speed*5; alarmton = 0;}}



    Ich bin mir nicht ganz sicher, aber es müsste so gehen.
    Wenns falsch ist, dann sorry :D
    Gruß Gamer
  • Und wieder ist die Hilfe dein Freund :P

    Rezept für regelmäßige Zeitabstände beim Abspielen von Sounds
    aus dem Hause gm-d

    Zutaten:
    • Ein if-Statement, in dem überprüft wird, ob der Wert health kleiner oder gleich 20 ist.
    • Ein Alarm-Event mit Zeitspanne room_speedx5
    • Den Befehl "Play a sound"
    • Eine beliebige, selbst definierte Variable (in diesem Beispiel heißt sie "foo")

    Zubereitung:


    Man definiere die Variable foo, indem man ihr im Create-Event den Wert "false" zuweist (im GM allerdings ohne die Anführungsstriche). Dann füge man im Step Event diesen Code ein:

    GML-Quellcode

    1. if health<=20{
    2. if foo=false{
    3. alarm[0]=room_speed+5;
    4. foo=true;
    5. }
    6. }
    7. else{
    8. if foo=true foo=false;
    9. }


    Das Alarm-Event wird folgendermaßen gestaltet:

    GML-Quellcode

    1. if foo=true{
    2. sound_play(/*Name deines Sounds*/);
    3. alarm[0]=room_speed*5;
    4. }



    In D&D übersetzt sieht das ganze wie folgt aus:

    Create-Event:

    Set Variable "foo" to false


    Step-Event:

    If health is smaller or equal to 20
    Start of a block
    If variable "foo" is false
    Start of a block
    Set alarm 0 to room_speed*5
    Set variable "foo" to true
    End of a block
    End of a block
    Else
    Start of a block
    If variable "foo" is true
    Set variable "foo" to false
    End of a block


    Alarm-0-Event:

    If variable "foo" is true
    Start of a block
    Play Sound "(dein Soundname hier)"
    Set Alarm 0 to room_speed*5
    End of a block


    Man lasse sich das Ergebnis etwa 10 Minuten lang durch den Kopf gehen und verstehe, wie das ganze funktioniert. Danach kann das Produkt verzehrt (also eingebaut) werden - als Beilage empfehlen wir, die Hilfedatei zu verschlingen.

    *hechel*... mann, ist das n Kreuz mit diesen D&D-Icons.
    Ich hoffe, das hat geholfen, sonst spring ich jetzt schreiend ausm Fenster.
  • Ps:

    Wenn du die Hilfe mal nicht kapierst, nochmal lesen, wenn du sie wieder nicht kapierst, konzentrieren und nochmal lesen und erst dann fragen.
    Mir ist auch schon aufgefallen, dass ich die Hilfe erst beim zweiten oder dritten Mal verstanden habe, weil manches kompliziert erklärt ist, aber das meiste ist recht einfach erklärt
    Gruß Gamer
  • Thx! Ich habs mit den codes gemacht...
    doch leider erscheint ein error!(spring bitte nicht aus dem Fenster!) Ich hab villeicht was falsch gemacht


    FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object obj_player:

    COMPILATION ERROR in code action
    Error in code at line 2:
    sound_play(/*sound10*/);

    at position 24: Wrong number of arguments to function or script.

    ich check den error ned...

    und den hilfslink kann ich ned anklicken ;(
    Ich bin noch neu im Forum und im Game Maker. Seid bitte nicht so streng. :|

    Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von Gamefreak99 ()

  • FATAL ERROR in
    action number 1
    of Alarm Event for alarm 0
    for object obj_player:

    COMPILATION ERROR in code action
    Error in code at line 2:
    sound_play(/sound10/);

    at position 13: Unexpected symbol in expression.




    kein Kommentar... :S
    Ich bin noch neu im Forum und im Game Maker. Seid bitte nicht so streng. :|