Skip to content

Commit

Permalink
Prepare code template
Browse files Browse the repository at this point in the history
  • Loading branch information
addianto authored Feb 29, 2024
1 parent e999075 commit 8c37f52
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 244 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# See: https://docs.godotengine.org/en/3.5/tutorials/scripting/gdscript/gdscript_styleguide.html#formatting
[*.gd]
indent_style = tab

[*.yml]
indent_size = 2
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Continuous Integration (CI)

on:
push:
pull_request:

jobs:
static-checks:
name: Static checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.1
- uses: Scony/godot-gdscript-toolkit@4.2.2
with:
version: 3.5.0
- run: gdformat --check scenes/
- run: gdlint scenes/
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Godot (https://github.com/github/gitignore/blob/main/Godot.gitignore)
# Godot 4+ specific ignores
.godot/

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg

# Imported translations (automatically generated from CSV files)
*.translation

# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json

# Project-specific files & folders to ignore

## Python virtual environment (contains gdtoolkit & pre-commit)
.env/
.venv/
env/
venv/
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: trailing-whitespace
25 changes: 0 additions & 25 deletions FallingFish.tscn

This file was deleted.

7 changes: 0 additions & 7 deletions LosePoint.gd

This file was deleted.

File renamed without changes
6 changes: 3 additions & 3 deletions dead.jpg.import → assets/dead.jpg.import
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/dead.jpg-9c8064678f556947d1215c6f9bf4cc11.stex"
path="res://.import/dead.jpg-d9023faabdf4328f7a4f73b8d7425bf1.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://dead.jpg"
dest_files=[ "res://.import/dead.jpg-9c8064678f556947d1215c6f9bf4cc11.stex" ]
source_file="res://assets/dead.jpg"
dest_files=[ "res://.import/dead.jpg-d9023faabdf4328f7a4f73b8d7425bf1.stex" ]

[params]

Expand Down
4 changes: 2 additions & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ _global_script_class_icons={

[application]

config/name="tutorial-4"
run/main_scene="res://Scenes/Level 1.tscn"
config/name="Tutorial 4 Template"
run/main_scene="res://scenes/Level1.tscn"
config/icon="res://icon.png"

[input]
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gdtoolkit==3.5.0
pre-commit==3.6.2
10 changes: 0 additions & 10 deletions scenes/Dead.tscn

This file was deleted.

7 changes: 0 additions & 7 deletions scenes/EndPoint.gd

This file was deleted.

13 changes: 0 additions & 13 deletions scenes/FallArea.gd

This file was deleted.

130 changes: 0 additions & 130 deletions scenes/Level 1.tscn

This file was deleted.

11 changes: 11 additions & 0 deletions scenes/Level1.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://Scenes/Player.tscn" type="PackedScene" id=1]

[node name="Level1" type="Node2D"]

[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 144, 52 )
collision_layer = 3
collision_mask = 3
speed = 300
10 changes: 10 additions & 0 deletions scenes/LoseScreen.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://assets/dead.jpg" type="Texture" id=1]

[node name="LoseScreen" type="Node2D"]

[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 512, 320 )
scale = Vector2( 0.76, 0.76 )
texture = ExtResource( 1 )
35 changes: 17 additions & 18 deletions scenes/Player.gd
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
extends KinematicBody2D

export (int) var speed = 400
export (int) var GRAVITY = 1200
export (int) var jump_speed = -400
const UP = Vector2(0, -1)

const UP = Vector2(0,-1)
export var speed: int = 400
export var GRAVITY: int = 1200
export var jump_speed: int = -400

var velocity = Vector2()
var velocity: Vector2 = Vector2()

onready var animator = self.get_node("Animator")
onready var sprite = self.get_node("Sprite")

func get_input():
velocity.x = 0
if is_on_floor() and Input.is_action_just_pressed('jump'):
if is_on_floor() and Input.is_action_just_pressed("jump"):
velocity.y = jump_speed
if Input.is_action_pressed('right'):
if Input.is_action_pressed("right"):
velocity.x += speed
if Input.is_action_pressed('left'):
if Input.is_action_pressed("left"):
velocity.x -= speed

func _physics_process(delta):

func _physics_process(_delta):
velocity.y += delta * GRAVITY
get_input()
velocity = move_and_slide(velocity, UP)

func _process(delta):

func _process(_delta):
if velocity.y != 0:
animator.play("Jump")
$Animator.play("Jump")
elif velocity.x != 0:
animator.play("Walk")
$Animator.play("Walk")
if velocity.x > 0:
sprite.flip_h = false
$Sprite.flip_h = false
else:
sprite.flip_h = true
$Sprite.flip_h = true
else:
animator.play("Idle")

$Animator.play("Idle")
Loading

0 comments on commit 8c37f52

Please sign in to comment.