Update 19th Mar:
Luckily, after digging into the API-doc, I found a possible solution and managed to get it run.
That’s to use Phaser.Tweens.Tween and Phaser.Curves.Path, add the container instance as “targets” property of paramter.
Question remaining:
- Still not sure about the implement of movement in squadron.
I’ll try.
Hi, everyone, glad to post my question here.
I’m a web front-end developer, new to game dev and attracted by Phaser 3.
Current question
- I could use a path and a follower.
- But I couldn’t add a container behaves like a follower to follow a path.
Background
- I’m developing a 2D RTS game demo. Units are vehicles.
- Like Axis and Allies, Company of Heroes and etc, players operate on squadrons instead of individual units.
- Squadrons are supposed to roughly keep formation during moving.
- Squadrons consist of vehicles, and vehicles are made up with turret(s) and body. A turret is composed of barrel(s) and shield.
- Vehicles have minimal-turning-radius.
Personal implements (pseudo code)
// Squadron, Vehicle, Turret are neither Sprite nor Image. They are Containers, which consist of Sprite or Image.
class Squadron extends Container {
Vehicles: Array<Vehicle>
attack()
retreat()
}
class Vehicle extends Container {
turrets: Array<Turret>
body: VehicleBody
move()
turn()
}
class Turret extends Container {
barrels: Array<Barrel>
shield: Shield
aimAt()
}
// VehicleBody is Sprite; Barrel and Shield are Image since I don't use animations on them
class VehicleBody extends Sprite {
MAX_SPEED: number
}
class Barrel extends Image {
FIRE_RATE: number
PENETRATION: number
}
class Shield extends Image {
THICKNESS: number
}
- I want to use path as squadron movement path.
- If possible, I also want to ask for your advice to improve my code design above, thanks.