development stage: phase 2
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
Player animations with multiple actors - phase 3
version specific Prequisites:
single tile generation system for unlimited scene.
some understanding of public static var as inter-behavior medium
scale actors which adjust the size of the actors during gameplay. https://stencyl-nator.blogspot.com/p/actors-tweening-scale-actor.html
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
In this case, the tile size both width and height = 512, thus half tile is 256. So you might replace the 512 and 256 to whichever suits your game project
This case also uses collision system other than Box2D and never use box 2D, see player code > col().
Zooming concepts
Since we do not use the zoom system provided by Stencyl, here is the illustration for the zoom positions. The black square shows where the boundary should be since the actor shrinks or grows via its center. This applies to collision.
codes:
Since this logic uses multiple behaviors and most of them are very long we nest the code to several pages
Conte:
The code to retrieving actor type, groups and other resourcs. bypassing a few layers of functions. Note: these numbers differs form game to game. Please construct using design mode then preview code.
package scripts;
import com.stencyl.Data;
import com.stencyl.Engine;
import com.stencyl.models.actor.Group;
import com.stencyl.models.actor.ActorType;
import com.stencyl.utils.LazyIntMap;
class Conte
{
public static function actor_group(s:String):Group
{
if(s == "objects"){return Engine.engine.groups.get(5);}
return null;
}
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 obj_atid(s:String):ActorType
{
if(s == "obj_stone_0"){return cast Data.instance.resources.get(71);}
if(s == "obj_stone_1"){return cast Data.instance.resources.get(73);}
if(s == "obj_stone_2"){return cast Data.instance.resources.get(75);}
if(s == "obj_stone_3"){return cast Data.instance.resources.get(77);}
if(s == "obj_stone_4"){return cast Data.instance.resources.get(79);}
if(s == "objdec_stone_0"){return cast Data.instance.resources.get(81);}
if(s == "objdec_stone_1"){return cast Data.instance.resources.get(83);}
if(s == "objdec_stone_2"){return cast Data.instance.resources.get(85);}
if(s == "objdec_stone_3"){return cast Data.instance.resources.get(87);}
if(s == "objdec_stone_4"){return cast Data.instance.resources.get(89);}
return null;
}
public static function player_atid(s:String):ActorType
{
if(s == "player_torso"){return cast Data.instance.resources.get(43);}
return null;
}
}
genertes tiles randonly.
The scene for the gameplay that holds everything togehter
load:
this one appies to another scene or co-called transition scene. Loading screen between scenes. Porgress bar not yet done.
ackage 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 = 24; 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;
this.file_name = "obdat_ids_nxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.ids_nxny = Reflect.field(file.data,"a"); file.close(); this.progress =13;
this.file_name = "obdat_ids_nxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.ids_nxpy = Reflect.field(file.data,"a"); file.close(); this.progress =14;
this.file_name = "obdat_ids_pxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.ids_pxny = Reflect.field(file.data,"a"); file.close(); this.progress =15;
this.file_name = "obdat_ids_pxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.ids_pxpy = Reflect.field(file.data,"a"); file.close(); this.progress =16;
this.file_name = "obdat_rfl_nxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rfl_nxny = Reflect.field(file.data,"a"); file.close(); this.progress =17;
this.file_name = "obdat_rfl_nxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rfl_nxpy = Reflect.field(file.data,"a"); file.close(); this.progress =18;
this.file_name = "obdat_rfl_pxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rfl_pxny = Reflect.field(file.data,"a"); file.close(); this.progress =19;
this.file_name = "obdat_rfl_pxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rfl_pxpy = Reflect.field(file.data,"a"); file.close(); this.progress =20;
this.file_name = "obdat_rot_nxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rot_nxny = Reflect.field(file.data,"a"); file.close(); this.progress =21;
this.file_name = "obdat_rot_nxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rot_nxpy = Reflect.field(file.data,"a"); file.close(); this.progress =22;
this.file_name = "obdat_rot_pxny"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rot_pxny = Reflect.field(file.data,"a"); file.close(); this.progress =23;
this.file_name = "obdat_rot_pxpy"; file = SharedObject.getLocal(Save.name+"_"+this.file_name); S_gameplay_behav.obdat.rot_pxpy = Reflect.field(file.data,"a"); file.close(); this.progress =24;
var tt:TimedTask = new TimedTask(this.cong,500,false,null);
Engine.engine.tasks.push(tt);
}
}
These objects are obstacle to players which player cannot pass through. The codes are very similar to floor data with decoratives to be added later.
The keypoard conrtols the movements and collision system without using Box2D.
save
applies to a button. Porgress bar not yet done.
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 = 25; 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;
this.save_file = "obdat_ids_nxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.ids_nxny); save_f.flush(); this.save_progress =14;
this.save_file = "obdat_ids_nxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.ids_nxpy); save_f.flush(); this.save_progress =15;
this.save_file = "obdat_ids_pxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.ids_pxny); save_f.flush(); this.save_progress =16;
this.save_file = "obdat_ids_pxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.ids_pxpy); save_f.flush(); this.save_progress =17;
this.save_file = "obdat_rfl_nxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rfl_nxny); save_f.flush(); this.save_progress =18;
this.save_file = "obdat_rfl_nxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rfl_nxpy); save_f.flush(); this.save_progress =19;
this.save_file = "obdat_rfl_pxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rfl_pxny); save_f.flush(); this.save_progress =20;
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.obdat.rfl_pxpy); save_f.flush(); this.save_progress =21;
this.save_file = "obdat_rot_nxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rot_nxny); save_f.flush(); this.save_progress =22;
this.save_file = "obdat_rot_nxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rot_nxpy); save_f.flush(); this.save_progress =23;
this.save_file = "obdat_rot_pxny"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rot_pxny); save_f.flush(); this.save_progress =24;
this.save_file = "obdat_rot_pxpy"; var save_f = SharedObject.getLocal(save_name+"_"+this.save_file);
Reflect.setField(save_f.data,"a",S_gameplay_behav.obdat.rot_pxpy); save_f.flush(); this.save_progress =25;
var tt:TimedTask = new TimedTask(this.pop_down,1000,false,null);
Engine.engine.tasks.push(tt);
}
Codes for zoom huds.
zoom in button
package scripts;
import com.stencyl.behavior.ActorScript;
class B_zoom_in_behav extends ActorScript
{
public var rh:RH = new RH();
public var mos:Bool = false;
public var x:Float; public var y:Float; public var w:Float; public var h:Float;
public function new(a,b,c){super(b);}
override public function init()
{
actor.handlesCollisions = false; // this actor is part of HUD so no collisions handling required.
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 = false;}
else if(ms == 1){this.mos = true;}
else if(ms == 3)
{
B_zoom_level_behav.zoom_level -=1;
S_gameplay_behav.set_zoom();
}
}
}
zoom level buttonpackage scripts;
import com.stencyl.behavior.ActorScript;
class B_zoom_level_behav extends ActorScript
{
public var rh:RH = new RH(); public var dtext:Dtext = new Dtext(55);
public var mos:Bool = false;
public var x:Float; public var y:Float; public var w:Float; public var h:Float;
public static var zoom_level:Int =0;
public function new(a,b,c){super(b);}
override public function init()
{
if(B_zoom_level_behav.zoom_level == null ||""+B_zoom_level_behav.zoom_level =="undefined"){B_zoom_level_behav.zoom_level =0;}
actor.handlesCollisions = false; // this actor is part of HUD so no collisions handling required.
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)
{
var zoom_string: String = "zoom out: "+B_zoom_level_behav.zoom_level;
if(this.mos){this.rh.draw(this.x,this.y,this.w,this.h);}
this.dtext.drawString(zoom_string,this.x + (this.w - this.dtext.get_text_width(zoom_string)) * 0.5,this.y + 8);
}
public function mis(ms:Int,u0)
{
if(ms == -1){this.mos = false;}
else if(ms == 1){this.mos = true;}
}
}
zoom out button
package scripts;
import com.stencyl.behavior.ActorScript;
class B_zoom_out_behav extends ActorScript
{
public var rh:RH = new RH();
public var mos:Bool = false;
public var x:Float; public var y:Float; public var w:Float; public var h:Float;
public function new(a,b,c){super(b);}
override public function init()
{
actor.handlesCollisions = false; // this actor is part of HUD so no collisions handling required.
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 = false;}
else if(ms == 1){this.mos = true;}
else if(ms == 3)
{
B_zoom_level_behav.zoom_level += 1;
S_gameplay_behav.set_zoom();
}
}
}

No comments:
Post a Comment