Skip to content

Commit

Permalink
add initXXXMod and call from BaseActor
Browse files Browse the repository at this point in the history
  • Loading branch information
hoge1e3 committed Jun 4, 2018
1 parent 50ae6a1 commit acf2693
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 199 deletions.
19 changes: 3 additions & 16 deletions www/Kernel/BaseActor.tonyu
Expand Up @@ -19,24 +19,11 @@ native Array;
this.y=y;
this.p=p;
}
_scheduler=_scheduler||$Scheduler;
if (Tonyu.runMode) _th=$Boot.schedule(this,"main",[]);
initSchedulerMod();
layer=layer||defaultLayer;
crashScale=1;
position=new Vec3View(this);
if (scaleX==null) scaleX=1;
if (rotation==null) rotation=0;
//if (this.rotate==null) this.rotate=0;
if (alpha==null) alpha=255;
if (zOrder==null) zOrder=0;
//if (age==null) age=0;
if (anim!=null && typeof anim=="object"){
animMode=true;
animFrame=0;
}else{
animMode=false;
}
if (animFps==null) animFps=1;
initSpriteMod();
initAnimMod();
}
nowait \extend(obj) {
return Tonyu.extend(this,obj);
Expand Down
9 changes: 9 additions & 0 deletions www/Kernel/graphics/AnimMod.tonyu
Expand Up @@ -3,6 +3,15 @@ includes SpriteMod,SchedulerMod,ParallelMod;
"field strict";
var anim,animMode,animFrame,animFps;

\initAnimMod(){
if (anim!=null && typeof anim=="object"){
animMode=true;
animFrame=0;
}else{
animMode=false;
}
if (animFps==null) animFps=1;
}
nowait \setAnimFps(f){
animFps=f;
animFrame=0;
Expand Down
7 changes: 7 additions & 0 deletions www/Kernel/graphics/SpriteMod.tonyu
Expand Up @@ -8,6 +8,13 @@ native Tonyu;
native Math;
native console;

\initSpriteMod() {
position=new Vec3View(this);
if (scaleX==null) scaleX=1;
if (rotation==null) rotation=0;
if (alpha==null) alpha=255;
if (zOrder==null) zOrder=0;
}
nowait \detectShape() {
if (typeof p!="number") {
p=0;
Expand Down

0 comments on commit acf2693

Please sign in to comment.