Have you built a game by using Egretia engine? Here is an example from our developer community.
Demonstration


Programming
>Make a scrolling background
class BG extends egret.Sprite{
public bg:egret.Bitmap[] = [];
public fg:egret.Bitmap; //foreground
public vy:number; //scroll speed
public game:MainGame; //previous pointer
public constructor(game:MainGame) {
super();
this.game = game;
for(let i = 0 ; i < 2; i ++){
this.bg[i] = Main.createBitmapByName(“bg11_jpg”);
this.addChild(this.bg[i]);
//background position
this.bg[i].y = 0 — i* this.bg[i].height;
}
this.vy = 10; //scroll speed
}
public update(){
for(let i = 0 ; i < 2; i++){
//scroll down
this.bg[i].y+=this.vy;
// background images will be repeated once they move off the screen
if(this.bg[i].y > 800){
// the height of the background images indicates how much to scroll
this.bg[i].y -=2*this.bg[i].height;
}
}
}
}
The foreground is randomly composed of three different images
public resetFG(){
//Random 0~2 0 high ladder,1,2
let id = Math.floor(Math.random()*3);
switch(id){
case 0 :
this.fg.texture = RES.getRes(“bg12_png”);
if(Math.random()*100 < 50){// conspectus of 50%, left or right
this.fg.scaleX = -1;
this.fg.x = 480;
}else{
this.fg.scaleX = 1;
this.fg.x = 0;
}
break;
case 1:
this.fg.texture = RES.getRes(“bg13_png”);
this.fg.x = 480 — Math.random()*184;
this.fg.scaleX = 1;
break;
case 2 :
this.fg.texture = RES.getRes(“bg13_png”);
this.fg.x = Math.random() * 184;
this.fg.scaleX = -1;
break;
}
this.fg.y = -500 — Math.random()*100;
}
>Players control

Trajectory principle:


What are the coolest projects you saw from people using Egretia engine?
Stay tuned for updates from the Egretia official channels below so that you can be involved in all the exciting things to come!
Egretia Telegram: https://t.me/Egretia
Egretia Twitter: https://twitter.com/Egretia_io
Egretia Website: https://egretia.io/