注释:
根据AGM的更新版本:V 1.0.17 实现无代码随机生成敌人
步骤:
1 创建一个游戏场景(主场景)和一个游戏对象(敌人)
2 在主场景中,创建一个子对象(敌人生成器)。(注意去掉重力,关掉碰撞盒。)
コメント:
AGMの更新バージョン:V 1.0.17 に基づき、コード不要で敵をランダム生成する機能を実装
手順:
1 ゲームシーン(メインシーン)とゲームオブジェクト(敵)を作成する
2 メインシーンで、サブオブジェクト(敵生成器)を作成します。(重力を解除し、衝突ボックスをオフにしてください。)
notes:
According to the updated version of AGM: V 1.0.17, it achieves codeless random enemy generation
Steps:
- Create a game scene (main scene) and a game object (enemy)
- In the main scene, create a child object (enemy spawner). (Note: Remove gravity and turn off the collision box.)
3 在项目数据库中,设置两个项目变量:随机X坐标,随机Y坐标。
3 プロジェクトデータベースに2つのプロジェクト変数を設定します:ランダムX座標、ランダムY座標。
In the project database, set two project variables: random X coordinate and random Y coordinate.
4 在子对象“敌人生成器”中,写事件脚本。
(1)设置变量的值
4 チャイルドオブジェクト「敵生成器」にイベントスクリプトを記述する。
(1)変数の値を設定する
- Write an event script in the child object “Enemy Generator”.
(1) Set the value of the variable
修改“随机X坐标”变量,为随机数,范围(收缩在屏幕范围之内)。
「ランダムX座標」変数を修正し、ランダム数にし、範囲を(画面内に収縮させ)する。
Modify the “Random X Coordinate” variable to a random number within the screen range.
注意修改摄像机的位置,让它与屏幕初始位置一致,否则生成的对象范围,要相应做负数调整,不然生成的敌人可能会在屏幕之外。
(2)开始做事件脚本状态机。
カメラの位置を修正し、画面の初期位置と一致させるように注意してください。そうでないと、生成されるオブジェクトの範囲に対応して負数調整が必要となり、生成される敵が画面の外に出てしまう可能性があります。
(2)イベントスクリプトの状態機械を作り始める。
Be sure to adjust the camera position so that it aligns with the initial position of the screen. Otherwise, the generated object range will need to be adjusted by a negative number accordingly, otherwise the generated enemies may appear outside the screen.
(2) Start developing the event script state machine.
第一个状态,已经设为了随机坐标,可在连线是,设定一个事件,然后生成第一个对象,并设定对象的属性。
最初の状態は、ランダム座標に設定されており、接続時にイベントを設定し、最初のオブジェクトを生成してオブジェクトの属性を設定できます。
In the first state, random coordinates have been set. When connecting lines, an event can be set, and then the first object is generated, with its properties set.
设定对象路径,生成位置为“GLOBAL_POSITION”,坐标为刚才生成的随机坐标变量
設定対象パスを設定し、生成位置を「GLOBAL_POSITION」、座標を先ほど生成したランダム座標変数とする
Set the object path, with the generation position being “GLOBAL_POSITION” and the coordinates being the randomly generated coordinate variables just now
创作状态机闭环,可复制动作,复制连线,已实现一个自动每隔一段时间就生成敌人的循环操作。(特别注意,在生成第一个物体的事件中,要重新设置一次X,Y随机变量坐标,以让AGM重新定位新的随机坐标,后面每生成一次,改一次坐标。)
状態マシンのクローズドループを構築し、動作を複製し、接続線を複製し、一定間隔で敵を生成する自動ループ操作を実現しました。(特に注意すべきは、最初のオブジェクトを生成するイベントで、AGMが新しいランダム座標に再定位できるようにX,Yのランダム変数座標を一度再設定し、以降は毎回生成するたびに座標を変更することです。)
The creation state machine is closed-loop, with actions and connections that can be replicated. A loop operation has been implemented to automatically generate enemies at regular intervals. (Special note: In the event of generating the first object, the X and Y random variable coordinates need to be reset to allow the AGM to reposition to new random coordinates. For each subsequent generation, the coordinates should be changed.)
最后:制作完成,F5测试!
最後:制作完了、F5テスト!
Finally: Production completed, F5 test!








