add skillshots
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Vector2 } from 'three'
|
||||
import Projectile from './projectile.js'
|
||||
|
||||
export default class Ability {
|
||||
static skillshot({ range, radius, speed, onCollide, after }) {
|
||||
return function(x, y) {
|
||||
console.log(this)
|
||||
const projectile = new Projectile()
|
||||
const destination = this.position.clone().add(new Vector2(x, y).sub(this.position).normalize().multiplyScalar(range))
|
||||
projectile.owner = this.id
|
||||
projectile.position.copy(this.position)
|
||||
projectile.destination = destination
|
||||
projectile.radius = radius
|
||||
projectile.speed = speed
|
||||
projectile.after = after
|
||||
projectile.onCollide = onCollide
|
||||
this.game?.spawnProjectile(projectile)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user