-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
138 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const IntentionPlayer = require('../IntentionPlayer') | ||
const TensorMath = require('../../lib/TensorMath') | ||
const Intention = require('../../Intention') | ||
const LineIntention = require('../../Intention/LineIntention') | ||
const PointIntention = require('../../Intention/PointIntention') | ||
const LookAtIntention = require('../../Intention/LookAtIntention') | ||
const OrbitalIntention = require('../../Intention/OrbitalIntention') | ||
const Vector = require('../../lib/Vector') | ||
const RulePlays = require('./RulePlays') | ||
|
||
const BASE_SPEED = 100 | ||
|
||
module.exports = class AttackerAvoidSides extends RulePlays { | ||
setup () { | ||
super.setup() | ||
let ball = () => { | ||
let ball = {x: this.match.dataManager.ball.x, y: this.match.dataManager.ball.y} | ||
let ballSide = ball.y/Math.abs(ball.y) | ||
|
||
|
||
return {x: ball.x, y: ball.y - ballSide * 100} | ||
} | ||
|
||
this.addIntetion(new PointIntention('goBallSides', { | ||
target: ball, | ||
radius: 150, | ||
decay: TensorMath.new.constant(1).deadWidth(0.15).finish, | ||
multiplier: 60 | ||
})) | ||
|
||
} | ||
loop(){ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const IntentionPlayer = require('../IntentionPlayer') | ||
const TensorMath = require('../../lib/TensorMath') | ||
const Intention = require('../../Intention') | ||
const LineIntention = require('../../Intention/LineIntention') | ||
const PointIntention = require('../../Intention/PointIntention') | ||
const LookAtIntention = require('../../Intention/LookAtIntention') | ||
const OrbitalIntention = require('../../Intention/OrbitalIntention') | ||
const Vector = require('../../lib/Vector') | ||
const RulePlays = require('./RulePlays') | ||
|
||
const BASE_SPEED = 65 | ||
|
||
module.exports = class AttackerSides extends RulePlays { | ||
|
||
setup () { | ||
super.setup() | ||
|
||
let ball = () => { | ||
let ball = {x: this.match.dataManager.ball.x, y: this.match.dataManager.ball.y} | ||
return ball | ||
} | ||
|
||
this.addIntetion(new PointIntention('goBallSides', { | ||
target: ball, | ||
radius: 150, | ||
decay: TensorMath.new.constant(1).deadWidth(0.15).finish, | ||
multiplier: 60 | ||
})) | ||
|
||
this.addIntetion(new LineIntention('avoidHitSide', { | ||
target: {x: 0, y: -655}, | ||
theta: Vector.direction("right"), | ||
lineSize: 2000, // Largura do segmento de reta | ||
lineDist: 100, // Tamanho da repelência | ||
lineDistMax:100, | ||
lineDistSingleSide: true, | ||
decay: TensorMath.new.mult(-1).finish, | ||
multiplier: 30 | ||
})) | ||
|
||
this.addIntetion(new LineIntention('avoidHitSide', { | ||
target: {x: 0, y: 655}, | ||
theta: Vector.direction("left"), | ||
lineSize: 2000, // Largura do segmento de reta | ||
lineDist: 100, // Tamanho da repelência | ||
lineDistMax:100, | ||
lineDistSingleSide: true, | ||
decay: TensorMath.new.mult(-1).finish, | ||
multiplier: 30 | ||
})) | ||
} | ||
|
||
loop () {} | ||
|
||
} |