Waffen wechsel

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

  • Waffen wechsel

    Hallo,
    Ich hab schon wieder ein problem:
    Ich möchte das der Spieler seine Waffen per Mausrad drehen kann(erstmal nebensächlich da ich denke der code schnipsel ist dafür richtig)
    Mein Probolem ist wenn ich eine Waffe aufheb, werden beide events ausgelöst,also es wird aus den zwei pistolen geschossen(bei mausKlick)und aus der maschinen pistole gefeuert (bei mausDruck)deswegen hab ich variabeln eingefügt aber das klappt nicht,warum auch immer.
    Hoffe ihr könnt helfen,danke im vorraus

    Code:
    Spoiler anzeigen

    GML-Quellcode

    1. Create Event:
    2. execute code:
    3. image_speed = 0
    4. image_index = 0
    5. friction = 0.5
    6. shoot =0
    7. wp_mp = 0
    8. wp_dual = 1
    9. weapon = wp_dual
    10. Alarm Event for alarm 0:
    11. execute code:
    12. image_index = 0
    13. Alarm Event for alarm 1:
    14. execute code:
    15. shoot =0
    16. Step Event:
    17. execute code:
    18. if (keyboard_check(ord('W'))) {
    19. speed = 4
    20. }
    21. if (keyboard_check(ord('S'))) {
    22. speed = -4
    23. }
    24. if (mouse_check_button_pressed(mb_left)) && shoot = 0 {
    25. if weapon = wp_dual {
    26. if wp_dual = 1 {
    27. shoot =1
    28. image_index = 1
    29. instance_create(x+lengthdir_x(32,direction),y+lengthdir_y(26,direction),obj_bullet)
    30. instance_create(x+lengthdir_x(4,direction),y+lengthdir_y(26,direction),obj_bullet)
    31. alarm[0] = 2
    32. alarm[1] = 8
    33. }
    34. }
    35. }
    36. if (mouse_check_button(mb_left)) && shoot = 0 {
    37. if weapon = wp_mp {
    38. if wp_mp = 1 {
    39. shoot =1
    40. image_index = 1
    41. instance_create(x+lengthdir_x(28,direction),y+lengthdir_y(26,direction),obj_bullet)
    42. alarm[0] = 1
    43. alarm[1] = 5
    44. }
    45. }
    46. }
    47. execute code:
    48. direction = point_direction(x,y,mouse_x,mouse_y)
    49. image_angle = direction
    50. Collision Event with object obj_block:
    51. execute code:
    52. move_contact_solid(direction-90,1)
    53. Collision Event with object obj_weapon_mp:
    54. execute code:
    55. wp_mp = 1
    56. Mouse Event for Mouse Wheel Up:
    57. execute code:
    58. if weapon = wp_dual {
    59. weapon = wp_mp
    60. }else{
    61. weapon = wp_dual
    62. }
    63. Mouse Event for Mouse Wheel Down:
    64. execute code:
    65. if weapon = wp_dual {
    66. weapon = wp_mp
    67. }else{
    68. weapon = wp_dual
    69. }
    Alles anzeigen
    Ich hab keine Ahnung
  • Mach das doch einfach?

    GML-Quellcode

    1. //Create Event
    2. waffe=0
    3. waffe_0=true
    4. waffe_1=true
    5. muni_1=100
    6. muni_0=100

    GML-Quellcode

    1. //Mouse Global Left (Pressend)
    2. if (waffe==0) && (muni_0>0) && (waffe_0)
    3. {
    4. with(instance_crete(x,y,obj_bla))
    5. {
    6. direction=point_direction(x,y,mouse_x,mouse_y)
    7. speed=5
    8. image_angel=direction
    9. }
    10. }
    11. if (waffe==1) && (muni_1>0) && (waffe_1)
    12. {
    13. with(instance_crete(x,y,obj_bla))
    14. {
    15. direction=point_direction(x,y,mouse_x,mouse_y)
    16. speed=5
    17. image_angel=direction
    18. }
    19. }
    Alles anzeigen

    GML-Quellcode

    1. //Mouse Whell Up
    2. if (waffe>0) { waffe=1 }
    3. if (waffe<1) { waffe=2 }

    GML-Quellcode

    1. //Mouse Whell Down
    2. if (waffe>0) { waffe=0 }
    3. if (waffe<1) { waffe=1 }

    MfG Henrik1235
    wupto.net/ Nicht meine Seite!
    We love Koalas.

    GM-D-Spam-o-Meter: 32%