Advertisement
Guest User

save and load issue

a guest
Feb 1st, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /////////////////////////////////SAVE
  2. /////////////////////////////////SAVE
  3. /////////////////////////////////SAVE
  4. file = get_save_filename(".lvl","")
  5. if file_exists(file)
  6. {
  7.     i=show_message_ext("overwrite?","Yes","","No")
  8.     if i = 0 || i = 3 exit;
  9. }
  10.  
  11.  
  12. f =file_bin_open(file,1)
  13. writeint(other.f,instance_number(oWall))
  14. with(oWallEditor)
  15. {    
  16.     writeint(other.f,pointx_1)
  17.     writeint(other.f,pointy_1)
  18.     writeint(other.f,pointx_2)
  19.     writeint(other.f,pointy_2)
  20. }
  21. writeint(f,instance_number(oLight))
  22. with(oLight)
  23. {
  24.     writeint(other.f,x)
  25.     writeint(other.f,y)
  26.     writeint(other.f,color_get_red(lightColor))
  27.     writeint(other.f,color_get_green(lightColor))
  28.     writeint(other.f,color_get_blue(lightColor))
  29.     writeint(other.f, image_xscale)
  30.     writeint(other.f, image_yscale)
  31. }
  32.  
  33. file_bin_close(f)
  34.  
  35. //////////////////////////////////LOAD
  36. //////////////////////////////////LOAD
  37. //////////////////////////////////LOAD
  38. file = get_open_filename(".lvl","")
  39. if !file_exists(file)
  40. {
  41.     show_message("file not found!")
  42.     exit;
  43. }
  44.  
  45.  
  46. f =file_bin_open(file,0)
  47. n = readint(f)
  48. repeat(n)
  49. {
  50.     nx = readint(f)
  51.     ny = readint(f)
  52.     nx2 = readint(f)
  53.     ny2 = readint(f)
  54.     o=instance_create(nx,ny,oWallEditor)
  55.     o.pointx_1 = nx
  56.     o.pointy_1 = ny
  57.     o.pointx_2 = nx2
  58.     o.pointy_2 = ny2
  59.     with(o){vector_wallset()}
  60. }
  61. show_message("made it to lights")
  62. n = readint(f)
  63. repeat(n)
  64. {
  65.     o = instance_create(readint(f),readint(f),oLight)
  66.     o.lightColor = make_color_rgb(readint(f),readint(f),readint(f))
  67.     o.image_xscale = readint(f)
  68.     o.image_yscale = readint(f)
  69. }
  70. file_bin_close(f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement