To execute, developers shall use the latest version of Egretia engine and Egretia Launcher
Egretia Compiler
In this case, developers only need to install the latest version of Launcher and download Egretia Compiler in the [Tools] tab, which can be used more easily without executing the npm install command in each project.
Besides, here is an update on webpack:
• legacy mode
o Fix the decorator sorting problem;
o Fix the error of namespace;
o Fix the problem that the global enumeration cannot be accessed;
o Add sourcemap;
o Fix the compilation error caused by .d.ts in the src folder;
o Modify the .ts matching rules in legacy mode and adopt the configuration in tsconfig.json instead of hard-coded the src folder;
• Linux platform support;
• Fix the problem that Egretia.is returns incorrect results after compilation;
• Optimize the output volume which has been reduced about 20%
• Add typescript.tsconfigPath;
Egretia UI Editor
• Add right click to resource library -> copy resource name;
• Exml source code supports formatting;
• Support drag the skin by pressing the right button;
• The resource manager supports deleting files through the Delete key;
• The right-click menu item displays the corresponding shortcut keys;
• The interface can be zoomed by the mouse wheel in the preview state;
• Adjust the step length of the size & position part of the attribute item to 1, which is more user-friendly;
•To change the shortcut skin of Button by dragging and dropping resources to the input box
• The custom components are sorted alphabetically for easy search;
• The component frame is drawn by canvas, and the skin editing is smoother;
• Fix that clicking may cause the component level to be changed in some cases
• Fix that frequent changes to the component location may cause the editor to crash;
• Fix the issue that the list in the Ctrl+P shortcut to open the file is not updated synchronously after the file is changed
• Fix the problem that the interface is not updated in real time after changing the component skin;
Document
• Optimize the page loading speed from an average of 2 seconds to an average of 300 milliseconds
• Upload multiple documents and remove some outdated documents
All the sample codes in the document are written in ES2015 version, e.g. declare Variables with let and const
Stay tuned for updates from the Egretia official channels below so that you can be involved in all the exciting things to come!
// add the loading interface to scene this.stage.addChild(this.main.loadingView); //read the resources await RES.loadGroup(“game”, 0, this.main.loadingView); //remove the interface this.stage.removeChild(this.main.loadingView);
>Add the images in interfaces
Create LoadingUI2
Main
loadResource()
this.loadingView = new LoadingUI2();
MainMenu
> Singleton Pattern and Create JSON
An implementation of the singleton pattern must:
ensure that only one instance of the singleton class ever exists;
and provide global access to that instance.
JSON is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types (or any other serializable value). It is a language-independent data format and a very common data format, with a diverse range of applications.
> Basic concepts of game design and game development:Separate data and logic
//shoot once every pass of main loop, the distance is 80
this.vy = -80; //-80 upwards
this.vx = 0 ;
this.dx = this.dy = 0 ;
this.n = 0;
break;
update():
//the special one will be scheduled in advance and automatically executed. The “return” will show up when it finishes.
if(this.id == 10){
//the distances between planes and them
this.dx +=this.vx;
this.dy +=this.vy;
//offset value:base value+offset
// coordinates of laser is base coordinates and changes
this.x = this.game.player.x + this.dx;
this.y = this.game.player.y + this.dy;
// test whether it’s off-screen
if(this.y < -100 ){
this.vis = false;
}
return;
}
>Tracking bullet
Demonstration
Version:1.0
StartHTML:000000275
EndHTML:000053955
StartFragment:000021508
EndFragment:000053873
StartSelection:000021508
EndSelection:000053869
SourceURL:https://medium.com/egretia/create-a-space-shooter-game-egretia-engine-tutorial-for-beginners-part-6-a93d80fc08de
Create A Space Shooter Game | Egretia Engine Tutorial For Beginners Part 6 | by Egretia Io | Egretia | Aug, 2020 | Medium
1)NPC:
NPCManager
//obtain NPC
public getNPC():NPC{
//length>0,NPC exists; if no, bounce off
if(this.nm.length > 0 ){
//if there is npc, choose one randomly
let npc = this.nm[Math.floor(Math.random()* this.nm.length)]