A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Character loaded form saved position jumps Into old default position

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    19

    Character loaded form saved position jumps Into old default position

    Hi I set up a save for a tile based game to save the character position, it works the load and save but when I move the character from the loaded position it jumps into the old default position tile it was on before the load but I need it to be able to move from the new loaded spot.
    I'm using ActionScript 2.0.

    Save
    PHP Code:
    on (release){ 
    _root.pos SharedObject.getLocal("game"); 
    _root.pos.data.charx _root.tiles.char._x
    _root.pos.data.chary _root.tiles.char._y
    _root.pos.data.xtile _root.xtile._x
    _root.pos.data.ytile _root.ytile._y

    Load
    PHP Code:
    on (release){ 
    _root.pos SharedObject.getLocal("game");
    _root.tiles.char._x _root.pos.data.charx
    _root.tiles.char._y _root.pos.data.chary
    _root.xtile._x _root.pos.data.xtile
    _root.ytile._y _root.pos.data.ytile


  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    When you move the character, you save again the new position? Otherwise, when loading, it will be placed in the old position (the old saved one)

    I just replicated your sittuation (kind of, i'm not seeing your full script and objects). I made a movieclip tiles, inside i made a movieclip char. Then I added drag events to the clip (faster than coding a keyboard movement for it) then i move the char, press save, the position is saved, i press load, and the char goes to the saved position. I move it again without saving, and it goes to the saved position again until I save a new position or update it.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    19
    Here is a small file I set up showing what the problem is, when viewing the swf just enlarge the sides to get to the save and load button. I don't understand what I did to end up getting that annoying jump when moving after the load.
    Thanks.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center