Create_0.gml 1.0 KB

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