Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint and check formatting via CI #5

Merged
merged 8 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
name: "Lint"
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup python
uses: actions/[email protected]
with:
python-version: "3.12"
cache: "pip"

- name: Upgrade setuptools
run: pip install --upgrade setuptools

- name: Install gdtoolkit
run: pip install gdtoolkit==4.*

- name: Lint
run: gdlint .

formatting:
runs-on: ubuntu-latest
name: "Formatting"
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup python
uses: actions/[email protected]
with:
python-version: "3.12"
cache: "pip"

- name: Upgrade setuptools
run: pip install --upgrade setuptools

- name: Install gdtoolkit
run: pip install gdtoolkit==4.*

- name: Check formatting
run: gdformat --check .
16 changes: 10 additions & 6 deletions enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,29 @@ extends CharacterBody2D

@export var movement_speed: float = 200.0

var start_navigating: bool = false

@onready var navigation_agent: NavigationAgent2D = $NavigationAgent2D
@onready var player: CharacterBody2D = %Player

var start_navigating: bool = false

func _ready():
navigation_agent.path_desired_distance = 4.0
navigation_agent.target_desired_distance = 4.0

call_deferred("actor_setup")


func actor_setup():
await get_tree().physics_frame

start_navigating = true

func _physics_process(delta):
if !start_navigating: return


func _physics_process(_delta):
if !start_navigating:
return

var current_agent_position: Vector2 = global_position
navigation_agent.target_position = player.position
var next_path_position: Vector2 = navigation_agent.get_next_path_position()
Expand Down
6 changes: 4 additions & 2 deletions player.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
extends CharacterBody2D

@export var speed = 300
@export var speed: float = 300.0


func get_input():
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
velocity = input_direction * speed

func _physics_process(delta):

func _physics_process(_delta):
get_input()
move_and_slide()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gdtoolkit==4.*