finished reowrking grid maps, polished astar pathfinding, started work on aiming functions --todo: change launch speed to constant, change aim function to take into account the angle it would need to launch at to hit mouse position like in peggle, add raycasting
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
|
||||
public partial class Attack : RigidBody2D
|
||||
@@ -8,17 +9,33 @@ public partial class Attack : RigidBody2D
|
||||
public bool _hovered = false;
|
||||
public int _damage = 1;
|
||||
public Vector2 _speed;
|
||||
public Path2D _predictionPath;
|
||||
public Commander _commanderOwner;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_predictionPath = GetNode<Path2D>("PredictedPath");
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
base._PhysicsProcess(delta);
|
||||
if (_speed != Vector2.Zero){
|
||||
ApplyCentralForce(_speed);
|
||||
ApplyCentralImpulse(_speed);
|
||||
_speed = Vector2.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawPath(List<Vector2> POINTS)
|
||||
{
|
||||
_predictionPath.Curve.ClearPoints();
|
||||
for (int i = 0; i < POINTS.Count; i++)
|
||||
{
|
||||
_predictionPath.Curve.AddPoint(POINTS[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Shoot(Vector2 FORCE){
|
||||
_speed = FORCE;
|
||||
GravityScale = 1;
|
||||
|
||||
Reference in New Issue
Block a user