Jump to content


Photo

Checking Saved file


  • Please log in to reply
6 replies to this topic

#1 trickyfatman

trickyfatman

    GMC Member

  • New Member
  • 30 posts
  • Version:GM8

Posted 28 April 2012 - 01:15 AM

So far i have a 3 slot save going on in my game right now and i was just curious if game maker can detect if the one game is saved if it can changed the object from "empty" to "saved". I have a load game menu at the start of a game and i am not working with .ini (honestly i dont understand it) so i was just curious when you start up the game how can it detect if it has a saved file and change the object into another showing the player they have a saved file
  • 0

#2 Lemon Pie

Lemon Pie

    GMC Member

  • GMC Member
  • 194 posts

Posted 28 April 2012 - 04:04 AM

if you save your games w/ a certain file name (say save1.sav in the folder 'save' in your program's directory) you can do:

if file_exists(working_directory+'\saves\save1.sav')
{
     sprite_index = spr_SavedSlot
}
else
{
     sprite_index = spr_EmptySlot
}

That is the simplest method that I know of anyways.
  • 0

#3 trickyfatman

trickyfatman

    GMC Member

  • New Member
  • 30 posts
  • Version:GM8

Posted 28 April 2012 - 10:39 PM

if you save your games w/ a certain file name (say save1.sav in the folder 'save' in your program's directory) you can do:

if file_exists(working_directory+'\saves\save1.sav')
{
     sprite_index = spr_SavedSlot
}
else
{
     sprite_index = spr_EmptySlot
}

That is the simplest method that I know of anyways.


Would i put this in a step event or what event would i put this into
  • 0

#4 Lemon Pie

Lemon Pie

    GMC Member

  • GMC Member
  • 194 posts

Posted 28 April 2012 - 10:45 PM

You could put it into the step event, and it would work, however that would be bad programing. In the create event should work just fine, then if you have a delete function call it again.
  • 0

#5 trickyfatman

trickyfatman

    GMC Member

  • New Member
  • 30 posts
  • Version:GM8

Posted 28 April 2012 - 11:05 PM

You could put it into the step event, and it would work, however that would be bad programing. In the create event should work just fine, then if you have a delete function call it again.


Thank you so far the coding is working but it looks like it erased my sprites like it checks it then my sprites don't show up
  • 0

#6 Lemon Pie

Lemon Pie

    GMC Member

  • GMC Member
  • 194 posts

Posted 28 April 2012 - 11:30 PM

do you have something in the draw event? If so then you need to add draw_self(); into your draw event code.
  • 0

#7 trickyfatman

trickyfatman

    GMC Member

  • New Member
  • 30 posts
  • Version:GM8

Posted 28 April 2012 - 11:32 PM

do you have something in the draw event? If so then you need to add draw_self(); into your draw event code.

No i found my problem i have it set as an object as well and named both my sprite and object the same name so it got confused but i fixed it thank you for all your help it works great now
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users