Advertisement
Guest User

Zombie Loading

a guest
Oct 21st, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///load_zom()
  2. //Creates zombies according to what was saved and applies their saved information. Takes data from the ini file.
  3.  
  4. with (zom){
  5. instance_destroy()
  6. }
  7.  
  8. //Convert the grid to a string and save it to an ini file.
  9. var load_zom_grid;
  10. load_zom_grid = ds_grid_create(1,1);
  11. ini_open("zombie_savedata.ini");
  12. var t_string;
  13. t_string = ini_read_string("Savedata", "ZombieGrid", "");
  14. if t_string != "" {ds_grid_read(load_zom_grid, t_string);
  15. ini_close();}
  16. else{
  17. ini_close();
  18. show_message("no zombie save file")
  19. exit
  20. }
  21.  
  22. //Create enough zombies and set their data to that which was loaded from the ini file.
  23. var gridheight, loadedzom, loadzom;
  24. gridheight=ds_grid_height(load_zom_grid)
  25. loadedzom=1
  26. while loadedzom<=gridheight{
  27. loadzom=instance_create(0,0,zom)
  28. with (loadzom){
  29. x=ds_grid_get(load_zom_grid,0,loadedzom)
  30. if x=0 show_message("returned x=0!")
  31. y=ds_grid_get(load_zom_grid,1,loadedzom)
  32. if y=0 show_message("returned y=0!")
  33. hp=ds_grid_get(load_zom_grid,2,loadedzom)
  34. if hp=0 show_message("returned hp=0!")
  35. targeting=ds_grid_get(load_zom_grid,3,loadedzom)
  36. target=ds_grid_get(load_zom_grid,4,loadedzom)
  37. loaded=1
  38. }
  39. loadedzom+=1
  40. }
  41.  
  42. ds_grid_destroy(load_zom_grid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement