so-called endless scene with zoom

development stage: phase 1

Introduction: 
No zoom levels suit every player. but here it is zoom being locked as a game feature until player reach some progress or activated via new game settings. 

Exclusions
colliions & objects - phase 2
Player animations with multiple actors - phase 2

version specific Prequisites:  
single tile generation system for unlimited scene.  
some understanding of public static var as inter-behavior medium

Warnings
This topic includes multiple behaviors. codes and something not provided by Stencyl itself.  
Drwing with no G for diagnosis. https://stencyl-nator.blogspot.com/p/drawing-without-using-stencylgraphicsg.html and for texts it is draw text version 2 

Code for gameplay scenes. 
package scripts;
import com.stencyl.Engine;
import com.stencyl.behavior.SceneScript; // all scene behviors extend SceneScript
import com.stencyl.behavior.Script; 
import com.stencyl.behavior.TimedTask;
import com.stencyl.models.Actor; 

class S_gameplay_behav extends SceneScript 
{
public var camx:Float; public var camy:Float; 
public var scew:Float; public var sceh:Float;
public var scrw:Float; public var scrh:Float; 
public var half_sceh:Float; public var half_scew:Float; 
public var half_scrh:Float; public var half_scrw:Float; 

public var diag_gate:Bool = false; // diagnosis variable

public static var camcx: Float; public static var camcy: Float; 
public static var disp_xcen:Float=0; public static var disp_ycen:Float=0;
public static var disp_xmax:Int=0; public static var disp_xmin:Int=0; public static var disp_ymax:Int=0; public static var disp_ymin:Int=0; 
public static var offsx: Float=0; public static var offsy:Float=0; 

public static var setting_zoom:Bool = false; public static var shifting:Bool = false;  
public static var tdat:Floor_data = new Floor_data();  
public static var zoom: Float = 1; public static var continued: Bool = false; public static var scene_name:String="";  public static var old_zoom:Float; 
public static var zoom_cx: Float; public static var zoom_cy:Float; 
public static var player_torso:Actor = null; 

public var dtext_s : Dtext = new Dtext(55); public var checklag:Int =0; public var diag_rf:RF = new RF(); 
public function new (){super();}

override public function init()
{
this.diag_rf.c =0; this.diag_rf.a =0.5; S_gameplay_behav.player_torso = null;  
this.sceh = Engine.sceneHeight; this.scew = Engine.sceneWidth; 
this.scrh = Engine.screenHeight; this.scrw = Engine.screenWidth; 
this.half_sceh = this.sceh/2; this.half_scew = this.scew/2;  
this.half_scrh = this.scrh/2; this.half_scrw = this.scrw/2;  
Script.createRecycledActor(Conte.atid("b_int"),0,0,Script.FRONT);
Script.createRecycledActor(Conte.atid("b_gameplay_menu"),0,170,Script.FRONT);
Script.createRecycledActor(Conte.atid("b_save_game"),0,233,Script.FRONT);
if(Player_ngs.unlock_zoom || Player_data.unlocked_zoom)
{
Script.createRecycledActor(Conte.atid("b_zoom_in"),0,135,Script.FRONT);
Script.createRecycledActor(Conte.atid("b_zoom_level"),37,135,Script.FRONT);
Script.createRecycledActor(Conte.atid("b_zoom_out"),140,135,Script.FRONT);
}
Engine.engine.whenDrawingListeners.push(dwg);

this.load_sce("","","player_room",0,0); 
}

public function init_sce()
{
S_gameplay_behav.tdat.init();  
Engine.cameraX = this.half_scew - this.half_scrw; Engine.cameraY = this.half_sceh - this.half_scrh;
S_gameplay_behav.camcx = Engine.cameraX + Engine.screenWidth/2; S_gameplay_behav.camcy = Engine.cameraY + Engine.screenHeight/2; 
this.camx = Engine.cameraX; this.camy = Engine.cameraY; 
S_gameplay_behav.disp_xcen = (this.camx + this.half_scrw - this.half_scew)/512/S_gameplay_behav.zoom + S_gameplay_behav.offsx/512; // checkm inconsistency
S_gameplay_behav.disp_ycen = (this.camy + this.half_scrh - this.half_sceh)/512/S_gameplay_behav.zoom + S_gameplay_behav.offsy/512;
S_gameplay_behav.disp_xmax = Std.int(Math.ceil(S_gameplay_behav.disp_xcen + this.half_scrw/512/S_gameplay_behav.zoom) + 2);
S_gameplay_behav.disp_xmin = Std.int(Math.floor(S_gameplay_behav.disp_xcen - this.half_scrw/512/S_gameplay_behav.zoom) - 1);
S_gameplay_behav.disp_ymax = Std.int(Math.ceil(S_gameplay_behav.disp_ycen + this.half_scrh/512/S_gameplay_behav.zoom) + 2);
S_gameplay_behav.disp_ymin = Std.int(Math.floor(S_gameplay_behav.disp_ycen - this.half_scrh/512/S_gameplay_behav.zoom) - 1);
S_gameplay_behav.camcx = Engine.cameraX + Engine.screenWidth/2; S_gameplay_behav.camcy = Engine.cameraY + Engine.screenHeight/2; 

var x:Int = S_gameplay_behav.disp_xmin; var y:Int = S_gameplay_behav.disp_ymin;
while (y < S_gameplay_behav.disp_ymax)
{
S_gameplay_behav.tdat.ren_horz(y, S_gameplay_behav.disp_xmin, S_gameplay_behav.disp_xmax); 
y = y +1;  
}
var init_player_x:Float = Engine.cameraX + Engine.screenWidth/2 -256; //fucus porblem here. 
var init_player_y:Float = Engine.cameraY + Engine.screenHeight/2 -256 ;
S_gameplay_behav.player_torso = Engine.engine.getRecycledActorOfTypeOnLayer(Conte.player_atid("player_torso"),init_player_x,init_player_y,1);
S_gameplay_behav.player_torso.growTo(S_gameplay_behav.zoom,S_gameplay_behav.zoom,0,null);
this.def();
}

public function def() // we will try without using when Updated Listeners. 
{
this.checklag +=1;
if(!S_gameplay_behav.setting_zoom)
{
var old_xmax:Int = S_gameplay_behav.disp_xmax; var old_xmin:Int = S_gameplay_behav.disp_xmin; 
var old_ymax:Int = S_gameplay_behav.disp_ymax; var old_ymin:Int = S_gameplay_behav.disp_ymin; 
var x:Int; var y:Int; 
S_gameplay_behav.camcx = Engine.cameraX + Engine.screenWidth/2; S_gameplay_behav.camcy = Engine.cameraY + Engine.screenHeight/2; 
this.camx = Engine.cameraX; this.camy = Engine.cameraY; 
S_gameplay_behav.disp_xmax = Std.int(Math.ceil(S_gameplay_behav.disp_xcen + this.half_scrw/512/S_gameplay_behav.zoom) + 2);
S_gameplay_behav.disp_xmin = Std.int(Math.floor(S_gameplay_behav.disp_xcen - this.half_scrw/512/S_gameplay_behav.zoom) - 1);
S_gameplay_behav.disp_ymax = Std.int(Math.ceil(S_gameplay_behav.disp_ycen + this.half_scrh/512/S_gameplay_behav.zoom) + 2);
S_gameplay_behav.disp_ymin = Std.int(Math.floor(S_gameplay_behav.disp_ycen - this.half_scrh/512/S_gameplay_behav.zoom) - 1);
if(S_gameplay_behav.disp_xmin < old_xmin) // left side
{
var a:Int = old_xmin; while(a > S_gameplay_behav.disp_xmin)
{
a = a -1; 
S_gameplay_behav.tdat.ren_vert(a,old_ymin,old_ymax);
}
}
else if(S_gameplay_behav.disp_xmin > old_xmin) // remove actor
{
var a:Int = old_xmin; while(a < S_gameplay_behav.disp_xmin)
{
S_gameplay_behav.tdat.remo_vert(a,old_ymin,old_ymax);
a = a +1; 
}
}

if(S_gameplay_behav.disp_xmax > old_xmax) // right side
{
var a:Int = old_xmax; while(a < S_gameplay_behav.disp_xmax)
{
S_gameplay_behav.tdat.ren_vert(a,old_ymin,old_ymax);
a = a +1; 
}
}
else if(S_gameplay_behav.disp_xmax < old_xmax)
{
var a:Int = old_xmax; while(a > S_gameplay_behav.disp_xmax)
{
a = a-1; 
S_gameplay_behav.tdat.remo_vert(a,old_ymin,old_ymax);
}
}

if(S_gameplay_behav.disp_ymin < old_ymin)// upperside
{
var a:Int = old_ymin; while(a > S_gameplay_behav.disp_ymin)
{
a = a-1; 
S_gameplay_behav.tdat.ren_horz(a,S_gameplay_behav.disp_xmin,S_gameplay_behav.disp_xmax);
}
}
else if(S_gameplay_behav.disp_ymin > old_ymin)
{
var a:Int = old_ymin; while(a < S_gameplay_behav.disp_ymin)
{
S_gameplay_behav.tdat.remo_horz(a,S_gameplay_behav.disp_xmin,S_gameplay_behav.disp_xmax);
a = a+1; 
}
}

if(S_gameplay_behav.disp_ymax > old_ymax) // lower side
{
var a:Int = old_ymax; while(a < S_gameplay_behav.disp_ymax)
{
S_gameplay_behav.tdat.ren_horz(a,S_gameplay_behav.disp_xmin,S_gameplay_behav.disp_xmax);
a = a+1; 
}
}
else if(S_gameplay_behav.disp_ymax < old_ymax)
{
var a:Int = old_ymax; while(a > S_gameplay_behav.disp_ymax)
{
a = a-1; 
S_gameplay_behav.tdat.remo_horz(a,S_gameplay_behav.disp_xmin,S_gameplay_behav.disp_xmax);
}
}
// shifting -- did not happen
}
if(Engine.cameraX < 0){this.shift_px();} // did go through this gate. 
else if(Engine.cameraX > Engine.sceneWidth - Engine.screenWidth){this.shift_nx();}
if(Engine.cameraY < 0){this.shift_py();}
else if(Engine.cameraY > Engine.sceneHeight - Engine.screenHeight){this.shift_ny();}
var tt:TimedTask = new TimedTask(this.next_frame,15,false,null); 
Engine.engine.tasks.push(tt);
}

public function dwg() // draws diagnosis data
{
this.diag_rf.fill_rec(195,0,200,300);
this.dtext_s.drawString("check lag: "+this.checklag,200,0);
this.dtext_s.drawString("zoom_mult: "+S_gameplay_behav.zoom,200,15);
this.dtext_s.drawString("cam center x: "+S_gameplay_behav.camcx,200,30);
this.dtext_s.drawString("cam center y: "+S_gameplay_behav.camcy,200,45);
this.dtext_s.drawString("disp_xcen: "+S_gameplay_behav.disp_xcen,200,60);
this.dtext_s.drawString("disp_ycen: "+S_gameplay_behav.disp_ycen,200,75);
this.dtext_s.drawString("disp_xmax: "+S_gameplay_behav.disp_xmax,200,90);
this.dtext_s.drawString("disp_xmin: "+S_gameplay_behav.disp_xmin,200,105);
this.dtext_s.drawString("disp_ymax: "+S_gameplay_behav.disp_ymax,200,120);
this.dtext_s.drawString("disp_ymin: "+S_gameplay_behav.disp_ymin,200,135);
this.dtext_s.drawString("number of tiles: "+S_gameplay_behav.tdat.number_of_actors,200,150);
this.dtext_s.drawString("offsx: "+S_gameplay_behav.offsx,200,165);
this.dtext_s.drawString("offsy: "+S_gameplay_behav.offsy,200,180);
this.dtext_s.drawString("create_x"+ Floor_data.diag_create_x,200,195);
this.dtext_s.drawString("save name: "+ Save.name,200,210);
}
public function load_sce(savename:String, region:String, map:String, udg:Int, level:Int)
{
this.init_sce();
}

public function next_frame(t:TimedTask){this.def();}
public static function end_set_zoom(t:TimedTask){S_gameplay_behav.setting_zoom = false;}
public static function move_cam(x:Float,y:Float){}
public static function set_zoom()
{
S_gameplay_behav.setting_zoom = true; 
S_gameplay_behav.old_zoom = S_gameplay_behav.zoom; 
S_gameplay_behav.zoom = Math.pow(1.2,0-B_zoom_level_behav.zoom_level);
S_gameplay_behav.tdat.set_zoom();
S_gameplay_behav.player_torso.say("Player_torso_behav","set_zoom");
var tt:TimedTask = new TimedTask(S_gameplay_behav.end_set_zoom,15,false,null); 
Engine.engine.tasks.push(tt);
}

public function shift_nx()
{
S_gameplay_behav.offsx += Engine.sceneWidth/2/S_gameplay_behav.zoom; 
S_gameplay_behav.tdat.shift_nx(); 
S_gameplay_behav.player_torso.say("Player_torso_behav","shift_nx");
Engine.cameraX -= this.half_scew; 
}
public function shift_ny()
{
S_gameplay_behav.offsy += Engine.sceneWidth/2/S_gameplay_behav.zoom; 
S_gameplay_behav.tdat.shift_ny(); 
S_gameplay_behav.player_torso.say("Player_torso_behav","shift_ny");
Engine.cameraY -= this.half_sceh; 
}
public function shift_px() 
{
this.diag_gate = true;
S_gameplay_behav.offsx -= Engine.sceneWidth/2/S_gameplay_behav.zoom;
S_gameplay_behav.tdat.shift_px(); 
S_gameplay_behav.player_torso.say("Player_torso_behav","shift_px");
Engine.cameraX += this.half_scew; 
}
public function shift_py() // shift actors to bottom
{
S_gameplay_behav.offsy -= Engine.sceneWidth/2/S_gameplay_behav.zoom; 
S_gameplay_behav.tdat.shift_py(); 
S_gameplay_behav.player_torso.say("Player_torso_behav","shift_py");
Engine.cameraY += this.half_sceh; 
}

}


Code for tile data 
package scripts;
import com.stencyl.Engine; //for actor creation purposes
import com.stencyl.models.Actor; 

class Floor_data
{
public var ids_nxny:Array <Dynamic> = []; public var ids_nxpy:Array <Dynamic>= []; 
        public var ids_pxny:Array <Dynamic>= []; public var ids_pxpy:Array <Dynamic>= [];
public var rfl_nxny:Array <Dynamic> = []; public var rfl_nxpy:Array <Dynamic>= []; 
        public var rfl_pxny:Array <Dynamic>= []; public var rfl_pxpy:Array <Dynamic>= [];
public var rot_nxny:Array <Dynamic> = []; public var rot_nxpy:Array <Dynamic>= []; 
        public var rot_pxny:Array <Dynamic>= []; public var rot_pxpy:Array <Dynamic>= [];

public var actors:Array <Dynamic> = []; public var place:String = ""; 
public var actors_posx:Array<Dynamic> =[]; public var actors_posy:Array<Dynamic>=[]; // these arriays to prevent aliasing. 

public var number_of_actors:Int =0; 

public static var diag_create_x:Float=0; public static var diag_create_y:Float=0; 

public function new(a:Int =0){}
public function create_floor(a:String, x:Int,y:Int) // center point = 
{
var create_x:Float = Engine.cameraX + Engine.screenWidth/2 + (x - S_gameplay_behav.disp_xcen)*512 *S_gameplay_behav.zoom; 
var create_y:Float = Engine.cameraY + Engine.screenHeight/2 + (y - S_gameplay_behav.disp_ycen)*512 *S_gameplay_behav.zoom; 
Floor_data.diag_create_x = create_x; //showing tat create_x has problem. 
if(this.actors[x] == null ||""+this.actors[x] == "undefined"){this.actors[x] = [];}
if(this.actors_posx[x] == null ||""+this.actors_posx[x] == "undefined"){this.actors_posx[x] = [];}
if(this.actors_posy[x] == null ||""+this.actors_posy[x] == "undefined"){this.actors_posy[x] = [];}
this.actors_posx[x][y] = create_x- 256 * (1 - S_gameplay_behav.zoom); this.actors_posy[x][y] = create_y- 256 * (1 - S_gameplay_behav.zoom); 
this.actors[x][y] = Engine.engine.getRecycledActorOfTypeOnLayer(Conte.floor_atid(a),create_x,create_y,0); this.number_of_actors +=1; 
if(this.get_rfl(x,y)){this.actors[x][y].tweenProps.realScaleXY.tween(-1,S_gameplay_behav.zoom,1,S_gameplay_behav.zoom,null,0);}
else this.actors[x][y].tweenProps.realScaleXY.tween(1,S_gameplay_behav.zoom,1,S_gameplay_behav.zoom,null,0);
this.actors[x][y].setX(this.actors[x][y].getX() - 256 * (1 - S_gameplay_behav.zoom)); this.actors[x][y].setY(this.actors[x][y].getY() - 256 * (1 - S_gameplay_behav.zoom));
this.actors[x][y].setValue("Floor_behav","x",x); this.actors[x][y].setValue("Floor_behav","y",y);
}
public function get_rfl(x,y):Bool
{
if(x < 0)
{
if(y < 0)
{
if(this.rfl_nxny[0-x] == null ||""+this.rfl_nxny[0-x] == "undefined"){return false;}
return this.rfl_nxny[0-x][0-y]; 
}
else
{
if(this.rfl_nxpy[0-x] == null ||""+this.rfl_nxpy[0-x] == "undefined"){return false;}
return this.rfl_nxpy[0-x][y]; 
}
}
else
{
if(y < 0)
{
if(this.rfl_pxny[x] == null ||""+this.rfl_pxny[x] == "undefined"){return false;}
return this.rfl_pxny[x][0-y]; 
}
else
{
if(this.rfl_pxpy[x] == null ||""+this.rfl_pxpy[x] == "undefined"){return false;}
return this.rfl_pxpy[x][y]; 
}
}
return false; 
}
public function init()
{
this.number_of_actors = 0; 
if(this.ids_nxny == null || ""+ this.ids_nxny =="undefined"){this.ids_nxny = [];}
if(this.ids_nxpy == null || ""+ this.ids_nxpy =="undefined"){this.ids_nxpy = [];}
if(this.ids_pxny == null || ""+ this.ids_pxny =="undefined"){this.ids_pxny = [];}
if(this.ids_pxpy == null || ""+ this.ids_pxpy =="undefined"){this.ids_pxpy = [];}

if(this.rfl_nxny == null || ""+ this.rfl_nxny =="undefined"){this.rfl_nxny = [];}
if(this.rfl_nxpy == null || ""+ this.rfl_nxpy =="undefined"){this.rfl_nxpy = [];}
if(this.rfl_pxny == null || ""+ this.rfl_pxny =="undefined"){this.rfl_pxny = [];}
if(this.rfl_pxpy == null || ""+ this.rfl_pxpy =="undefined"){this.rfl_pxpy = [];}

if(this.rot_nxny == null || ""+ this.rot_nxny =="undefined"){this.rot_nxny = [];}
if(this.rot_nxpy == null || ""+ this.rot_nxpy =="undefined"){this.rot_nxpy = [];}
if(this.rot_pxny == null || ""+ this.rot_pxny =="undefined"){this.rot_pxny = [];}
if(this.rot_pxpy == null || ""+ this.rot_pxpy =="undefined"){this.rot_pxpy = [];}
}
public function load()
{
this.init(); 
}
public function randgen_ids(): String
{
var a:Int = Std.int(Math.floor( Math.random() * 9.999));
if(a == 0) return "dun0"; 
if(a == 1) return "dun1"; 
if(a == 2) return "dun2"; 
if(a == 3) return "dun3"; 
if(a == 4) return "dun4"; 
if(a == 5) return "dun5"; 
if(a == 6) return "dun6"; 
if(a == 7) return "dun7"; 
if(a == 8) return "dun8"; 
if(a == 9) return "dun9"; 
return ""; 
}
public function randgen_rfl():Bool
{
var a:Float = Math.random(); 
if(a < 0.5) return false;
else return true;
return false; 
}
public function randgen_rot():Int
{
var a:Int = Std.int(Math.floor(Math.random() * 3.99));
if(a==0) return 0;
else if(a==2) return 90;
else if(a==3) return 180;
else if(a==4) return 270;
return 0; 
}
public function remo_horz(y,xmin,xmax)
{
var x:Int = xmin; 
while(x < xmax)
{
if(this.actors[x]==null ||""+this.actors[x]=="undefined"){}
else if(Std.is(this.actors[x][y],Actor))
{
Engine.engine.recycleActor(this.actors[x][y]); this.actors[x][y] = null; 
this.number_of_actors -=1; 
}
x = x +1; 
}
}
public function remo_vert(x,ymin,ymax)
{
if(this.actors[x]==null ||""+this.actors[x]=="undefined"){return;}
var y:Int = ymin;
while(y < ymax)
{
if(Std.is(this.actors[x][y],Actor))
{
Engine.engine.recycleActor(this.actors[x][y]); this.actors[x][y] = null; 
this.number_of_actors -=1; 
}
y = y+1;
}
}
public function ren_horz(y,xmin,xmax)
{
var x:Int = xmin; 
var ids: String; var rfl:Bool; var rot:Int; 
if(y < 0)
{
x = xmin; 
while(x < xmax)
{
if(this.actors[x]== null ||""+this.actors == "undefined"){this.actors[x]=[];}
if(this.actors_posx[x] == null ||""+this.actors_posx[x] == "undefined"){this.actors_posx[x] = [];}
if(this.actors_posy[x] == null ||""+this.actors_posy[x] == "undefined"){this.actors_posy[x] = [];}
if(x < 0)
{
if(this.ids_nxny[0-x] == null ||""+this.ids_nxny[0-x]=="undefined"){this.ids_nxny[0-x]=[];}
if(this.rfl_nxny[0-x] == null ||""+this.rfl_nxny[0-x]=="undefined"){this.rfl_nxny[0-x]=[];}
if(this.rot_nxny[0-x] == null ||""+this.rot_nxny[0-x]=="undefined"){this.rot_nxny[0-x]=[];}

if(this.ids_nxny[0-x][0-y] == null ||""+this.ids_nxny[0-x][0-y]=="undefined"){this.ids_nxny[0-x][0-y]=this.randgen_ids();}
if(this.rfl_nxny[0-x][0-y] == null ||""+this.rfl_nxny[0-x][0-y]=="undefined"){this.rfl_nxny[0-x][0-y]=this.randgen_rfl();}
if(this.rot_nxny[0-x][0-y] == null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=this.randgen_rot();}

ids = this.ids_nxny[0-x][0-y]; rfl = this.rfl_nxny[0-x][0-y]; rot = this.rot_nxny[0-x][0-y]; 
}
else
{
if(this.ids_pxny[x] == null ||""+this.ids_pxny[x]=="undefined"){this.ids_pxny[x]=[];}
if(this.rfl_pxny[x] == null ||""+this.rfl_pxny[x]=="undefined"){this.rfl_pxny[x]=[];}
if(this.rot_pxny[x] == null ||""+this.rot_pxny[x]=="undefined"){this.rot_pxny[x]=[];}

if(this.ids_pxny[x][0-y] == null ||""+this.ids_pxny[x][0-y]=="undefined"){this.ids_pxny[x][0-y]=this.randgen_ids();}
if(this.rfl_pxny[x][0-y] == null ||""+this.rfl_pxny[x][0-y]=="undefined"){this.rfl_pxny[x][0-y]=this.randgen_rfl();}
if(this.rot_pxny[x][0-y] == null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=this.randgen_rot();}

ids = this.ids_pxny[x][0-y]; rfl = this.rfl_pxny[x][0-y]; rot = this.rot_pxny[x][0-y]; 
}
this.create_floor(ids,x,y);
x = x +1; 
}
}
else
{
x = xmin; 
while(x < xmax)
{
if(this.actors[x]== null ||""+this.actors == "undefined"){this.actors[x]=[];}
if(x < 0)
{
if(this.ids_nxpy[0-x] == null ||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.rfl_nxpy[0-x] == null ||""+this.rfl_nxpy[0-x]=="undefined"){this.rfl_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x] == null ||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}

if(this.ids_nxpy[0-x][y] == null ||""+this.ids_nxpy[0-x][y]=="undefined"){this.ids_nxpy[0-x][y]=this.randgen_ids();}
if(this.rfl_nxpy[0-x][y] == null ||""+this.rfl_nxpy[0-x][y]=="undefined"){this.rfl_nxpy[0-x][y]=this.randgen_rfl();}
if(this.rot_nxpy[0-x][y] == null ||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]=this.randgen_rot();}

ids = this.ids_nxpy[0-x][y]; rfl = this.rfl_nxpy[0-x][y]; rot = this.rot_nxpy[0-x][y];
}
else
{
if(this.ids_pxpy[x] == null ||""+this.ids_pxpy[x]=="undefined"){this.ids_pxpy[x]=[];}
if(this.rfl_pxpy[x] == null ||""+this.rfl_pxpy[x]=="undefined"){this.rfl_pxpy[x]=[];}
if(this.rot_pxpy[x] == null ||""+this.rot_pxpy[x]=="undefined"){this.rot_pxpy[x]=[];}

if(this.ids_pxpy[x][y] == null ||""+this.ids_pxpy[x][y]=="undefined"){this.ids_pxpy[x][y]=this.randgen_ids();}
if(this.rfl_pxpy[x][y] == null ||""+this.rfl_pxpy[x][y]=="undefined"){this.rfl_pxpy[x][y]=this.randgen_rfl();}
if(this.rot_pxpy[x][y] == null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=this.randgen_rot();}

ids = this.ids_pxpy[x][y]; rfl = this.rfl_pxpy[x][y]; rot = this.rot_pxpy[x][y];
}
this.create_floor(ids,x,y);
x = x +1; 
}
}
}
public function ren_vert(x,ymin,ymax)
{
var y:Int =  ymin;
var ids: String; var rfl:Bool; var rot:Int; 
if(this.actors[x]== null ||""+this.actors == "undefined"){this.actors[x]=[];}
if(this.actors_posx[x] == null ||""+this.actors_posx[x] == "undefined"){this.actors_posx[x] = [];}
if(this.actors_posy[x] == null ||""+this.actors_posy[x] == "undefined"){this.actors_posy[x] = [];}
if(x < 0)
{
if(this.ids_nxny[0-x] == null ||""+this.ids_nxny[0-x]=="undefined"){this.ids_nxny[0-x]=[];}
if(this.rfl_nxny[0-x] == null ||""+this.rfl_nxny[0-x]=="undefined"){this.rfl_nxny[0-x]=[];}
if(this.rot_nxny[0-x] == null ||""+this.rot_nxny[0-x]=="undefined"){this.rot_nxny[0-x]=[];}

if(this.ids_nxpy[0-x] == null ||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.rfl_nxpy[0-x] == null ||""+this.rfl_nxpy[0-x]=="undefined"){this.rfl_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x] == null ||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}
while(y < ymax)
{
if(y < 0)
{
if(this.ids_nxny[0-x][0-y] == null ||""+this.ids_nxny[0-x][0-y]=="undefined"){this.ids_nxny[0-x][0-y]=this.randgen_ids();}
if(this.rfl_nxny[0-x][0-y] == null ||""+this.rfl_nxny[0-x][0-y]=="undefined"){this.rfl_nxny[0-x][0-y]=this.randgen_rfl();}
if(this.rot_nxny[0-x][0-y] == null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=this.randgen_rot();}
ids = this.ids_nxny[0-x][0-y]; rfl = this.rfl_nxny[0-x][0-y]; rot = this.rot_nxny[0-x][0-y]; 
}
else
{
if(this.ids_nxpy[0-x][y] == null ||""+this.ids_nxpy[0-x][y]=="undefined"){this.ids_nxpy[0-x][y]=this.randgen_ids();}
if(this.rfl_nxpy[0-x][y] == null ||""+this.rfl_nxpy[0-x][y]=="undefined"){this.rfl_nxpy[0-x][y]=this.randgen_rfl();}
if(this.rot_nxpy[0-x][y] == null ||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]=this.randgen_rot();}
ids = this.ids_nxpy[0-x][y]; rfl = this.rfl_nxpy[0-x][y]; rot = this.rot_nxpy[0-x][y];
}
this.create_floor(ids,x,y);
y = y+1;
}
}
else
{
if(this.ids_pxny[x] == null ||""+this.ids_pxny[x]=="undefined"){this.ids_pxny[x]=[];}
if(this.rfl_pxny[x] == null ||""+this.rfl_pxny[x]=="undefined"){this.rfl_pxny[x]=[];}
if(this.rot_pxny[x] == null ||""+this.rot_pxny[x]=="undefined"){this.rot_pxny[x]=[];}

if(this.ids_pxpy[x] == null ||""+this.ids_pxpy[x]=="undefined"){this.ids_pxpy[x]=[];}
if(this.rfl_pxpy[x] == null ||""+this.rfl_pxpy[x]=="undefined"){this.rfl_pxpy[x]=[];}
if(this.rot_pxpy[x] == null ||""+this.rot_pxpy[x]=="undefined"){this.rot_pxpy[x]=[];}
while(y < ymax)
{
if(y < 0)
{
if(this.ids_pxny[x][0-y] == null ||""+this.ids_pxny[x][0-y]=="undefined"){this.ids_pxny[x][0-y]=this.randgen_ids();}
if(this.rfl_pxny[x][0-y] == null ||""+this.rfl_pxny[x][0-y]=="undefined"){this.rfl_pxny[x][0-y]=this.randgen_rfl();}
if(this.rot_pxny[x][0-y] == null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=this.randgen_rot();}
ids = this.ids_pxny[x][0-y]; rfl = this.rfl_pxny[x][0-y]; rot = this.rot_pxny[x][0-y]; 
}
else
{
if(this.ids_pxpy[x][y] == null ||""+this.ids_pxpy[x][y]=="undefined"){this.ids_pxpy[x][y]=this.randgen_ids();}
if(this.rfl_pxpy[x][y] == null ||""+this.rfl_pxpy[x][y]=="undefined"){this.rfl_pxpy[x][y]=this.randgen_rfl();}
if(this.rot_pxpy[x][y] == null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=this.randgen_rot();}
ids = this.ids_pxpy[x][y]; rfl = this.rfl_pxpy[x][y]; rot = this.rot_pxpy[x][y];
}
this.create_floor(ids,x,y);
y = y+1;
}
}
}
public function set_zoom()
{
var old_zoom = S_gameplay_behav.old_zoom;  
var cam_center_x :Float = Engine.cameraX + 0.5 * Engine.screenWidth; 
var cam_center_y :Float = Engine.cameraY + 0.5 * Engine.screenHeight;
var delt_x:Float; var delt_y:Float; var new_delt_x:Float; var new_delt_y:Float; 
var xmax:Int = S_gameplay_behav.disp_xmax; var xmin:Int = S_gameplay_behav.disp_xmin;
var ymax:Int = S_gameplay_behav.disp_ymax; var ymin:Int = S_gameplay_behav.disp_ymin;
var x:Int = xmin; var y:Int = ymin;
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined"){this.actors[x] = [];}
if(this.actors_posx[x] == null ||""+this.actors_posx[x] == "undefined"){this.actors_posx[x] = [];}
if(this.actors_posy[x] == null ||""+this.actors_posy[x] == "undefined"){this.actors_posy[x] = [];}
y = ymin; while(y < ymax)
{
if(Std.is(this.actors[x][y],Actor))
{
if(this.get_rfl(x,y)){this.actors[x][y].tweenProps.realScaleXY.tween(-1,S_gameplay_behav.zoom,1,S_gameplay_behav.zoom,null,0);}
else{this.actors[x][y].tweenProps.realScaleXY.tween(1,S_gameplay_behav.zoom,1,S_gameplay_behav.zoom,null,0);}
delt_x = this.actors_posx[x][y] + 256*(1 - old_zoom) - cam_center_x; 
delt_y = this.actors_posy[x][y] + 256*(1 - old_zoom) - cam_center_y; // differences between upper left corner and camera center. 
new_delt_x = delt_x * S_gameplay_behav.zoom / old_zoom; new_delt_y = delt_y * S_gameplay_behav.zoom / old_zoom; 
this.actors_posx[x][y] = cam_center_x + new_delt_x - 256*(1 - S_gameplay_behav.zoom);
this.actors_posy[x][y] = cam_center_y + new_delt_y - 256*(1 - S_gameplay_behav.zoom);
this.actors[x][y].setX(this.actors_posx[x][y]); this.actors[x][y].setY(this.actors_posy[x][y]);
}
y = y+1; 
}
x = x +1; 
}
}
public function shift_nx() // sfint actors to the left. 
{
var x:Int = S_gameplay_behav.disp_xmin; var y:Int; 
while(x < S_gameplay_behav.disp_xmax)
{
if(this.actors[x] != null &&""+ this.actors[x] != "undefined")
{
y = S_gameplay_behav.disp_ymin; while(y  < S_gameplay_behav.disp_ymax)
{
if(Std.is(this.actors[x][y],Actor))
{
this.actors_posx[x][y] -= Engine.sceneWidth/2; 
this.actors[x][y].setX(this.actors_posx[x][y]);
}
y = y+1; 
}
}
x = x +1;
}
}
public function shift_ny() //shift actors to the right
{
var x:Int = S_gameplay_behav.disp_xmin; var y:Int; 
while(x < S_gameplay_behav.disp_xmax)
{
if(this.actors[x] != null &&""+ this.actors[x] != "undefined")
{
y = S_gameplay_behav.disp_ymin; while(y  < S_gameplay_behav.disp_ymax)
{
if(Std.is(this.actors[x][y],Actor))
{
this.actors_posy[x][y] -= Engine.sceneHeight/2; 
this.actors[x][y].setY(this.actors_posy[x][y]);
}
y = y+1; 
}
x = x +1;
}
}
public function shift_px()
{
var x:Int = S_gameplay_behav.disp_xmin; var y:Int; 
while(x < S_gameplay_behav.disp_xmax)
{
if(this.actors[x] != null &&""+ this.actors[x] != "undefined")
{
y = S_gameplay_behav.disp_ymin; while(y  < S_gameplay_behav.disp_ymax)
{
if(Std.is(this.actors[x][y],Actor))
{
this.actors_posx[x][y] += Engine.sceneWidth/2; 
this.actors[x][y].setX(this.actors_posx[x][y]);
}
y = y+1; 
}
}
x = x +1;
}
}
public function shift_py()
{
var x:Int = S_gameplay_behav.disp_xmin; var y:Int; 
while(x < S_gameplay_behav.disp_xmax)
{
if(this.actors[x] != null &&""+ this.actors[x] != "undefined")
{
y = S_gameplay_behav.disp_ymin; while(y  < S_gameplay_behav.disp_ymax)
{
if(Std.is(this.actors[x][y],Actor))
{
this.actors_posy[x][y] += Engine.sceneHeight/2; 
this.actors[x][y].setY(this.actors_posy[x][y]);
}
y = y+1; 
}
x = x +1;
}
}

Code for the player
package scripts;
import com.stencyl.Engine;
import com.stencyl.behavior.ActorScript;
import com.stencyl.behavior.Script;
import com.stencyl.behavior.TimedTask;
import com.stencyl.models.Actor; 

class Player_torso_behav extends ActorScript
{
public var diag_text: Dtext = new Dtext(); 
public var anim_cycle:Float =0; public var player_speed = 1; 
public var posx:Float; public var posy:Float; // player position anti-aliasing
public var move_x: Float =0; public var move_y : Float =0; 

public var move_east:Bool = false; public var move_north:Bool = false; public var move_south = false; public var move_west = false; 
public var direction:Int =0; public var moving = false; 
public var arm_left:Actor = null; public var arm_right:Actor = null; 
public var ear_left:Actor = null; public var ear_right:Actor = null;
public var head:Actor = null; public var tail:Actor; 

public static var speed:Float = 1; 
public function new (a,b,c){super(b);}
     
override public function init()
{
this.diag_text.red_pwr =0; this.diag_text.gre_pwr =0; this.diag_text.blu_pwr =0; 
this.posx = actor.getX(); this.posy = actor.getY(); 
addKeyStateListener("a",press_west); addKeyStateListener("d",press_east);
addKeyStateListener("w",press_north); addKeyStateListener("s",press_south);
this.def(); actor.whenDrawingListeners.push(diag_drawing);
}

public function def():Void
{
var tt:TimedTask = new TimedTask(this.next_frame,20,false,null); 
if(this.moving)
{
var dx:Float = move_x * Player_data.speed; 
var dy:Float = move_y * Player_data.speed; 
this.posx += dx * S_gameplay_behav.zoom; this.posy += dy* S_gameplay_behav.zoom; 
actor.setX(this.posx); actor.setY(this.posy);
Engine.cameraX = actor.getX() - Engine.screenWidth/2 + actor.cacheWidth/2 ; 
Engine.cameraY = actor.getY() - Engine.screenHeight/2 + actor.cacheHeight/2 ; 
S_gameplay_behav.disp_xcen  += dx /512; 
S_gameplay_behav.disp_ycen  += dy /512; 
}
Engine.engine.tasks.push(tt);
}
public function diag_drawing()
{
var dx:Float = actor.getX() - Engine.cameraX; 
var dy:Float = actor.getY() - Engine.cameraY; 
this.diag_text.drawString("movex: "+ this.move_x, dx,dy);
this.diag_text.drawString("movey: "+ this.move_y, dx,dy+20);
this.diag_text.drawString("moving:" + this.moving,dx,dy + 40);
}
public function get_anim(a:Float):String 
{
var b:Int = Std.int(a); 
if(b == 0){return "neutral";}
return "neutral"; 
}

public function next_frame(a:TimedTask):Void{this.def();}

public function press_east(p:Bool,r:Bool,u0)
{
if(p)
{
this.moving = true; 
this.move_east = true; 
if(this.move_west)
{
if(this.move_north && !(this.move_south)){this.direction =0; this.move_x =0; this.move_y = -1;}
else if(!(this.move_north) && this.move_south){this.direction =180; this.move_x =0; this.move_y = 1;}
else {this.direction = 90;}
}
else 
{
if(this.move_north && !(this.move_south)){this.direction = 45;this.move_x =0.707; this.move_y = -0.707;}
else if(!(this.move_north) && this.move_south){this.direction = 135;this.move_x =0.707; this.move_y = 0.707;}
else {this.direction = 90; this.move_x = 1; this.move_y = 0;}
}
}
else if(r)
{
this.move_east = false; 
if(this.move_west)
{
if(this.move_north && !(this.move_south)){this.direction = 315;this.move_x =-0.707; this.move_y = -0.707;}
else if(!(this.move_north) && this.move_south){this.direction = 225;this.move_x =-0.707; this.move_y = 0.707;}
else {this.direction = 270; this.move_x = -1; this.move_y = 0;}
}
else
{
if(this.move_north && !(this.move_south)){this.direction = 0; this.move_x = 0; this.move_y = -1;}
else if(!(this.move_north) && this.move_south){this.direction = 180;this.move_x = 0; this.move_y = 1;}
else this.stop_player_movement();  
}
}
actor.tweenProps.angle.tween(actor.getAngleInDegrees(),this.direction,null,0);
}
public function press_north(p:Bool,r:Bool,u0) // showing that this is no typo
{
if(p)
{
this.moving = true; 
this.move_north = true; 
if(this.move_south)
{
if(this.move_east && !(this.move_west)){this.direction =90;this.move_x = 1; this.move_y = 0;}
else if(!(this.move_east) && this.move_west){this.direction =270;this.move_x = -1; this.move_y = 0;}
else {this.direction = 0;}  
}
else
{
if(this.move_east && !(this.move_west)){this.direction = 45;this.move_x =0.707; this.move_y = -0.707;}
else if(!(this.move_east) && this.move_west){this.direction = 315;this.move_x =-0.707; this.move_y = -0.707;}
else {this.direction = 0; this.move_x =0; this.move_y =-1;}  // direction work, but movement did not
}
}
else if(r)
{
this.move_north = false; 
if(this.move_south)
{
if(this.move_east && !(this.move_west)){this.direction = 135;this.move_x =0.707; this.move_y = 0.707;}
else if(!(this.move_east) && this.move_west){this.direction = 225;this.move_x =-0.707; this.move_y = 0.707;}
else {this.direction = 180;this.move_x = 0; this.move_y = 1;}
}
else
{
if(this.move_east && !(this.move_west)){this.direction = 90;this.move_x = 1; this.move_y = 0;}
else if(!(this.move_east) && this.move_west){this.direction = 270;this.move_x = -1; this.move_y = 0;}
else this.stop_player_movement();  
}
}
actor.tweenProps.angle.tween(actor.getAngleInDegrees(),this.direction,null,0);
}
public function press_west(p:Bool,r:Bool,u0)
{
if(p)
{
this.moving = true; 
this.move_west = true; 
if(this.move_east)
{
if(this.move_north && !(this.move_south)){this.direction = 0;this.move_x = 0; this.move_y = -1;}
else if(!(this.move_north) && this.move_south){this.direction = 180;this.move_x = 0; this.move_y = 1;}
else {this.direction = 270;}
}
else
{
if(this.move_north && !(this.move_south)){this.direction = 315;this.move_x =-0.707; this.move_y = -0.707;}
else if(!(this.move_north) && this.move_south){this.direction = 225;this.move_x =-0.707; this.move_y = 0.707;}
else {this.direction = 270;this.move_x = -1; this.move_y = 0;}
}
}
else if(r)
{
this.move_west = false; 
if(this.move_east)
{
if(this.move_north && !(this.move_south)){this.direction = 45;this.move_x =-0.707; this.move_y = 0.707;}
else if(!(this.move_north) && this.move_south){this.direction = 135;this.move_x =0.707; this.move_y = 0.707;}
else {this.direction = 90;this.move_x = 1; this.move_y = 0;}
}
else
{
if(this.move_north && !(this.move_south)){this.direction = 0;this.move_x = 0; this.move_y = -1;}
else if(!(this.move_north) && this.move_south){this.direction = 180;this.move_x = 0; this.move_y = 1;}
else this.stop_player_movement();  
}
}
actor.tweenProps.angle.tween(actor.getAngleInDegrees(),this.direction,null,0);
}
public function press_south(p:Bool,r:Bool,u0)
{
if(p)
{
this.moving = true; 
this.move_south = true; 
if(this.move_north)
{
if(this.move_east && !(this.move_west)){this.direction = 90;this.move_x = 1; this.move_y = 0;}
else if(!(this.move_east) && this.move_west){this.direction = 270;this.move_x = -1; this.move_y = 0;}
else {this.direction = 180;}
}
else
{
if(this.move_east && !(this.move_west)){this.direction = 135;this.move_x =0.707; this.move_y = 0.707;}
else if(!(this.move_east) && this.move_west){this.direction = 225;this.move_x =-0.707; this.move_y = 0.707;}
else {this.direction = 180;this.move_x = 0; this.move_y = 1;}
}
}
else if(r)
{
this.move_south = false; 
if(this.move_north)
{
if(this.move_east && !(this.move_west)){this.direction = 45;this.move_x =0.707; this.move_y = -0.707;}
else if(!(this.move_east) && this.move_west){this.direction = 315;this.move_x = -0.707; this.move_y = -0.707;}
else {this.direction = 0;this.move_x = 0; this.move_y = -1;}
}
else
{
if(this.move_east && !(this.move_west)){this.direction = 90;this.move_x = 1; this.move_y = 0;}
else if(!(this.move_east) && this.move_west){this.direction = 270;this.move_x = -1; this.move_y = 0;}
else this.stop_player_movement();
}
}
actor.tweenProps.angle.tween(actor.getAngleInDegrees(),this.direction,null,0);
}

public function set_zoom(){actor.growTo(S_gameplay_behav.zoom,S_gameplay_behav.zoom,0,null);}
public function stop_player_movement(){this.moving = false; this.move_east = false; this.move_north = false; this.move_south = false; this.move_west = false;}

public function shift_nx(){this.posx -= Engine.sceneWidth/2;}
public function shift_ny(){this.posy -= Engine.sceneHeight/2;}
public function shift_px(){this.posx += Engine.sceneWidth/2;}
public function shift_py(){this.posy += Engine.sceneHeight/2;}
}



code for loading system - load button - player data
package scripts;
import com.stencyl.behavior.ActorScript; 
import com.stencyl.behavior.Script; 
import flash.net.SharedObject; 

class B_load_behav extends ActorScript
{
public var x:Float; public var y:Float; public var w:Float; public var h:Float; 
public var mos:Bool = false; public var rh:RH = new RH(); 
public function new (a,b,c){super(b);}
override public function init()
{
actor.handlesCollisions = false; actor.anchorToScreen(); 
this.x=actor.getX(); this.y = actor.getY(); this.w = actor.cacheWidth; this.h = actor.cacheHeight; 
actor.whenDrawingListeners.push(dwg); actor.mouseOverListeners.push(mis);
}

public function dwg(u0,u1,u2,u3)
{
if(this.mos){this.rh.draw(this.x,this.y,this.w,this.h);}
}

public function mis(ms:Int,u0)
{
if(ms ==1){this.mos = true;}
else if(ms == -1){this.mos = false;}
else if(ms == 3){this.load_game();}
}

public function load_game()
{
var pdata:SharedObject = SharedObject.getLocal(T_loadgame_behav.savename+"_pdata");
S_gameplay_behav.zoom = Reflect.field(pdata.data,"zoom");
B_zoom_level_behav.zoom_level = Reflect.field(pdata.data,"zoom_level");
Player_data.unlocked_zoom = Reflect.field(pdata.data,"unlocked_zoom");  
Player_data.speed = Reflect.field(pdata.data,"speed");  
S_gameplay_behav.offsx = Reflect.field(pdata.data,"offsx"); S_gameplay_behav.offsy = Reflect.field(pdata.data,"offsy"); 
I_loadgame_behav.save_exists = Reflect.field(pdata.data,"save_exists");
I_loadgame_behav.loaded = true; 

if(P_loadgame_behav.b_newgame == null)
{
Script.createRecycledActor(Conte.atid("b_newgame"),Sce0_behav.p_loadgame.getX() + 20,Sce0_behav.p_loadgame.getY()+ 790,Script.FRONT);
P_loadgame_behav.b_newgame = Script.lastCreatedActor; 
}
if(I_loadgame_behav.save_exists)
{
if(P_loadgame_behav.b_continue_game == null)
{
Script.createRecycledActor(Conte.atid("b_continue"),Sce0_behav.p_loadgame.getX() + 170,Sce0_behav.p_loadgame.getY()+ 790,Script.FRONT);
P_loadgame_behav.b_continue_game = Script.lastCreatedActor; 
}
}
}
}

code for loading screen- - scene data
package scripts;
import com.stencyl.Engine; 
import com.stencyl.behavior.SceneScript;
import com.stencyl.behavior.Script;  
import com.stencyl.behavior.TimedTask; 
import flash.net.SharedObject; 

class S_continue_behav extends SceneScript
{
public var dtext:Dtext = new Dtext(); public var number_of_files = 12; public var progress =0; 
public var file_name: String = ""; 
public function new(){super();}
override public function init()
{
Script.createRecycledActor(Conte.atid("bg_load"),0,0,Script.FRONT);
Engine.engine.whenDrawingListeners.push(dwg);
this.load();
}
public function cong(a):Void
{
Engine.engine.switchScene(2,null,null); 
}

public function dwg(u0,u1,u2,u3)
{
this.dtext.drawString("loading map data",0,5);
this.dtext.drawString("loading user:" + Save.name,5,25);
this.dtext.drawString("loading file:" + this.file_name,5,45);
this.dtext.drawString("progress" + this.progress + " of " + this.number_of_files,5,65);
}

public function load()
{
this.file_name = "tdat_ids_nxny"; var file:SharedObject = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.ids_nxny = Reflect.field(file.data,"a"); file.close(); this.progress =1; 
this.file_name = "tdat_ids_nxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.ids_nxpy = Reflect.field(file.data,"a"); file.close(); this.progress =2; 
this.file_name = "tdat_ids_pxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.ids_pxny = Reflect.field(file.data,"a"); file.close(); this.progress =3; 
this.file_name = "tdat_ids_pxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.ids_pxpy = Reflect.field(file.data,"a"); file.close(); this.progress =4; 

this.file_name = "tdat_rfl_nxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rfl_nxny = Reflect.field(file.data,"a"); file.close(); this.progress =5; 
this.file_name = "tdat_rfl_nxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rfl_nxpy = Reflect.field(file.data,"a"); file.close(); this.progress =6; 
this.file_name = "tdat_rfl_pxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rfl_pxny = Reflect.field(file.data,"a"); file.close(); this.progress =7; 
this.file_name = "tdat_rfl_pxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rfl_pxpy = Reflect.field(file.data,"a"); file.close(); this.progress =8; 

this.file_name = "tdat_rot_nxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rot_nxny = Reflect.field(file.data,"a"); file.close(); this.progress =9; 
this.file_name = "tdat_rot_nxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rot_nxpy = Reflect.field(file.data,"a"); file.close(); this.progress =10; 
this.file_name = "tdat_rot_pxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rot_pxny = Reflect.field(file.data,"a"); file.close(); this.progress =11; 
this.file_name = "tdat_rot_pxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.tdat.rot_pxpy = Reflect.field(file.data,"a"); file.close(); this.progress =12; 

var tt:TimedTask = new TimedTask(this.cong,500,false,null); 
Engine.engine.tasks.push(tt);
}
}


code for saving system - save button
package scripts;
import com.stencyl.Engine; 
import com.stencyl.behavior.ActorScript;
import com.stencyl.behavior.TimedTask;
import flash.net.SharedObject; 

class B_save_game_behav extends ActorScript
{
public var save_completed:Bool = false; public var save_file:String = "player_data";
public var rh:RH = new RH(); public var rf:RF = new RF(); public var dtext:Dtext = new Dtext(); 
public var bar_bg:RF = new RF(); public var bar_pr:RF = new RF(); 
public var mos:Bool = false; 
public var x:Float; public var y:Float; public var w:Float; public var h:Float; 
public var is_saving: Bool = false; 
public var number_of_save_files:Int = 13; public var save_progress: Int =0;  

public static var pp_x:Float = 400; public static var pp_y:Float = 300; 
public function new(a,b,c){super(b);}
override public function init()
{
actor.handlesCollisions = false; actor.anchorToScreen(); 
this.bar_bg.c = 0x543210; this.bar_bg.a =1;
this.bar_pr.c = 0x987654; this.bar_pr.a =1;
this.x=actor.getX(); this.y = actor.getY(); this.w = actor.cacheWidth; this.h = actor.cacheHeight; 
actor.whenDrawingListeners.push(dwg); actor.mouseOverListeners.push(mis);
}
public function dwg(u0,u1,u2,u3)
{
if(this.mos){this.rh.draw(this.x,this.y,this.w,this.h);}
if(this.is_saving)
{
var px:Float = B_save_game_behav.pp_x; var py:Float =  B_save_game_behav.pp_y;
this.rf.fill_rec(px,py,1000,400); 
this.bar_bg.fill_rec(px + 5,py+100,990,25); 
this.bar_pr.fill_rec(px + 5,py+100,400,25); 
this.dtext.drawString("saving",px+5,py);
this.dtext.drawString("save name:" + Save.name,px+5,py+20);
this.dtext.drawString("save file:" + Save.name+"_"+this.save_file,px+5,py+40);
this.dtext.drawString("save progress:" + this.save_progress + " of "+ this.number_of_save_files,px+5,py+60);
}
}//data
public function mis(ms:Int,u0)
{
if(ms == -1){this.mos = false;}
else if(ms == 1){this.mos = true;}
else if(ms == 3)
{
if(!(this.is_saving))
{
this.save_completed = false; this.is_saving = true; this.save_game();
}
else if(this.is_saving)
{
this.is_saving = false; 
}
}
}
public function pop_down(a):Void
{
this.is_saving = false; this.save_completed = false; 
}

public function save_game()
{
this.save_progress =0; var save_name:String = Save.name; 
var player_data:SharedObject = SharedObject.getLocal(save_name+"_pdata");
Reflect.setField(player_data.data,"zoom_level",B_zoom_level_behav.zoom_level);
Reflect.setField(player_data.data,"zoom",S_gameplay_behav.zoom);
Reflect.setField(player_data.data,"save_exists",true);
Reflect.setField(player_data.data,"speed",Player_data.speed);
Reflect.setField(player_data.data,"unlocked_zoom",Player_data.unlocked_zoom); 
Reflect.setField(player_data.data,"offsx",S_gameplay_behav.offsx + (Engine.cameraX + Engine.screenWidth/2 - Engine.sceneWidth/2)/S_gameplay_behav.zoom);
Reflect.setField(player_data.data,"offsy",S_gameplay_behav.offsy + (Engine.cameraY + Engine.screenHeight/2 - Engine.sceneHeight/2)/S_gameplay_behav.zoom);
player_data.flush(); this.save_progress =1; 

this.save_file = "tdat_ids_nxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.ids_nxny); save_f.flush(); this.save_progress =2; 
this.save_file = "tdat_ids_nxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.ids_nxpy); save_f.flush(); this.save_progress =3; 
this.save_file = "tdat_ids_pxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.ids_pxny); save_f.flush(); this.save_progress =4; 
this.save_file = "tdat_ids_pxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.ids_pxpy); save_f.flush(); this.save_progress =5; 

this.save_file = "tdat_rfl_nxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rfl_nxny); save_f.flush(); this.save_progress =6; 
this.save_file = "tdat_rfl_nxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rfl_nxpy); save_f.flush(); this.save_progress =7; 
this.save_file = "tdat_rfl_pxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rfl_pxny); save_f.flush(); this.save_progress =8; 
this.save_file = "tdat_rfl_pxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rfl_pxpy); save_f.flush(); this.save_progress =9; 

this.save_file = "tdat_rot_nxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rot_nxny); save_f.flush(); this.save_progress =10; 
this.save_file = "tdat_rot_nxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rot_nxpy); save_f.flush(); this.save_progress =11; 
this.save_file = "tdat_rot_pxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rot_pxny); save_f.flush(); this.save_progress =12; 
this.save_file = "tdat_rot_pxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.tdat.rot_pxpy); save_f.flush(); this.save_progress =13; 
var tt:TimedTask = new TimedTask(this.pop_down,1000,false,null); 
Engine.engine.tasks.push(tt);
}
}


Conte - costom actor type directory
package scripts;
import com.stencyl.Data; 
import com.stencyl.models.actor.ActorType; 
import com.stencyl.utils.LazyIntMap; 

class Conte
{
public static function atid(s:String):ActorType
{
if(s == "b_play"){return cast Data.instance.resources.get(2);}
if(s == "b_close"){return cast Data.instance.resources.get(7);}
if(s == "b_continue"){return cast Data.instance.resources.get(15);}
if(s == "b_gameplay_menu"){return cast Data.instance.resources.get(51);}
if(s == "b_int"){return cast Data.instance.resources.get(47);}
if(s == "b_loadgame"){return cast Data.instance.resources.get(11);}
if(s == "b_mainmenu"){return cast Data.instance.resources.get(19);}
if(s == "b_newgame"){return cast Data.instance.resources.get(13);}
if(s == "b_ngs_player_speed"){return cast Data.instance.resources.get(64);}
if(s == "b_ngs_unlock_zoom"){return cast Data.instance.resources.get(56);}
if(s == "b_options"){return cast Data.instance.resources.get(53);}
if(s == "b_save_game"){return cast Data.instance.resources.get(66);}
if(s == "b_start"){return cast Data.instance.resources.get(21);}
if(s == "b_int"){return cast Data.instance.resources.get(49);}
if(s == "b_zoom_in"){return cast Data.instance.resources.get(58);}
if(s == "b_zoom_level"){return cast Data.instance.resources.get(62);}
if(s == "b_zoom_out"){return cast Data.instance.resources.get(60);}
if(s == "bg_load"){return cast Data.instance.resources.get(68);}
if(s == "i_loadgame"){return cast Data.instance.resources.get(17);}
if(s == "main_menu_background"){return cast Data.instance.resources.get(0);}
if(s == "p_loadgame"){return cast Data.instance.resources.get(5);}
if(s == "t_loadgame"){return cast Data.instance.resources.get(9);}
return null; 
}

public static function floor_atid(s:String):ActorType
{
if(s== "dun0"){return cast Data.instance.resources.get(23);}
if(s== "dun1"){return cast Data.instance.resources.get(25);}
if(s== "dun2"){return cast Data.instance.resources.get(27);}
if(s== "dun3"){return cast Data.instance.resources.get(29);}
if(s== "dun4"){return cast Data.instance.resources.get(31);}
if(s== "dun5"){return cast Data.instance.resources.get(33);}
if(s== "dun6"){return cast Data.instance.resources.get(35);}
if(s== "dun7"){return cast Data.instance.resources.get(37);}
if(s== "dun8"){return cast Data.instance.resources.get(39);}
if(s== "dun9"){return cast Data.instance.resources.get(41);}
return null; 
}

public static function player_atid(s:String):ActorType
{
if(s == "player_torso"){return cast Data.instance.resources.get(43);}
return null; 
}
}



No comments:

Post a Comment