Create_0.gml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /// @description init menu
  2. enum STATE
  3. {
  4. INIT,
  5. SELECT,
  6. ACTIVATE,
  7. WAIT,
  8. ATTACK,
  9. MOBATTACK,
  10. TEST
  11. }
  12. state = STATE.INIT;
  13. win_width = window_get_width();
  14. win_height = window_get_height();
  15. // Cards in hand
  16. card_hand = [];
  17. card_selected = 0;
  18. card_change = 0;
  19. // Card activated action
  20. card_active_stats = 0;
  21. // Spawn Card
  22. for(i=0; i<=4; i+=1;)
  23. {
  24. card = instance_create_depth(0, 0, -600, obj_card);
  25. array_push(card_hand, card);
  26. spacing = i * 4;
  27. with(card)
  28. {
  29. x = other.i * width + other.spacing + 50;
  30. y = other.win_height - height;
  31. if (other.i == 0)
  32. selected = true;
  33. }
  34. }
  35. // Spawn Mobs
  36. mobs_arr = [];
  37. mobs_nb = irandom_range(1, 4);
  38. for (mob_i=0; mob_i<mobs_nb; mob_i++;)
  39. {
  40. var _mob_inst = instance_create_depth(0, 0, -500, obj_enemy)
  41. array_push(mobs_arr, _mob_inst);
  42. with(_mob_inst)
  43. {
  44. // centering the mobs onscreen
  45. var _all_mobs_width = sprite_width * other.mobs_nb + 20;
  46. var _mobs_leftmost = get_win_midx(_all_mobs_width);
  47. var _relative_x = (_all_mobs_width / other.mobs_nb) * other.mob_i;
  48. x = _mobs_leftmost + _relative_x;
  49. }
  50. }
  51. // Spawn Hero
  52. instance_create_depth(0, 0, 40, obj_player);