Create_0.gml 870 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /// @description init menu
  2. win_width = window_get_width();
  3. win_height = window_get_height();
  4. // Cards in hand
  5. card_hand = [];
  6. card_selected = 0;
  7. card_change = 0;
  8. // Spawn Card
  9. for(i=0; i<=4; i+=1;)
  10. {
  11. card = instance_create_depth(0, 0, -600, obj_card);
  12. array_push(card_hand, card);
  13. spacing = i * 4;
  14. with(card)
  15. {
  16. x = other.i * width + other.spacing + 50;
  17. y = other.win_height - height;
  18. if (other.i == 0)
  19. selected = true;
  20. }
  21. }
  22. // Spawn Mobs
  23. mobs_nb = irandom_range(1, 4);
  24. for (mob_i=0; mob_i<mobs_nb; mob_i++;)
  25. {
  26. mob_inst = instance_create_depth(0, 0, -500, obj_enemy);
  27. with(mob_inst)
  28. {
  29. // centering the mobs onscreen
  30. var _all_mobs_width = sprite_width * other.mobs_nb + 20;
  31. var _mobs_leftmost = get_win_midx(_all_mobs_width);
  32. var _relative_x = (_all_mobs_width / other.mobs_nb) * other.mob_i;
  33. x = _mobs_leftmost + _relative_x;
  34. }
  35. }