initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# meta-description: Classic movement for gravity games (platformer, ...)
|
||||
|
||||
extends _BASE_
|
||||
|
||||
|
||||
const SPEED = 300.0
|
||||
const JUMP_VELOCITY = -400.0
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var direction := Input.get_axis("ui_left", "ui_right")
|
||||
if direction:
|
||||
velocity.x = direction * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
@@ -0,0 +1,30 @@
|
||||
# meta-description: Classic movement for gravity games (FPS, TPS, ...)
|
||||
|
||||
extends _BASE_
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Get the input direction and handle the movement/deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
@@ -0,0 +1,24 @@
|
||||
# meta-description: Basic plugin template
|
||||
|
||||
@tool
|
||||
extends _BASE_
|
||||
|
||||
|
||||
func _enable_plugin() -> void:
|
||||
# Add autoloads here.
|
||||
pass
|
||||
|
||||
|
||||
func _disable_plugin() -> void:
|
||||
# Remove autoloads here.
|
||||
pass
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
# Initialization of the plugin goes here.
|
||||
pass
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
# Clean-up of the plugin goes here.
|
||||
pass
|
@@ -0,0 +1,10 @@
|
||||
# meta-description: Basic import script template
|
||||
|
||||
@tool
|
||||
extends _BASE_
|
||||
|
||||
|
||||
# Called by the editor when a scene has this script set as the import script in the import tab.
|
||||
func _post_import(scene: Node) -> Object:
|
||||
# Modify the contents of the scene upon import.
|
||||
return scene # Return the modified root node when you're done.
|
@@ -0,0 +1,8 @@
|
||||
# meta-description: Basic import script template (no comments)
|
||||
|
||||
@tool
|
||||
extends _BASE_
|
||||
|
||||
|
||||
func _post_import(scene: Node) -> Object:
|
||||
return scene
|
@@ -0,0 +1,9 @@
|
||||
# meta-description: Basic editor script template
|
||||
|
||||
@tool
|
||||
extends _BASE_
|
||||
|
||||
|
||||
# Called when the script is executed (using File -> Run in Script Editor).
|
||||
func _run() -> void:
|
||||
pass
|
13
modules/gdscript/editor/script_templates/Node/default.gd
Normal file
13
modules/gdscript/editor/script_templates/Node/default.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
# meta-description: Base template for Node with default Godot cycle methods
|
||||
|
||||
extends _BASE_
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
3
modules/gdscript/editor/script_templates/Object/empty.gd
Normal file
3
modules/gdscript/editor/script_templates/Object/empty.gd
Normal file
@@ -0,0 +1,3 @@
|
||||
# meta-description: Empty template suitable for all Objects
|
||||
|
||||
extends _BASE_
|
@@ -0,0 +1,18 @@
|
||||
# meta-description: Base template for rich text effects
|
||||
|
||||
@tool
|
||||
# Having a class name is handy for picking the effect in the Inspector.
|
||||
class_name RichText_CLASS_
|
||||
extends _BASE_
|
||||
|
||||
|
||||
# To use this effect:
|
||||
# - Enable BBCode on a RichTextLabel.
|
||||
# - Register this effect on the label.
|
||||
# - Use [_CLASS_SNAKE_CASE_ param=2.0]hello[/_CLASS_SNAKE_CASE_] in text.
|
||||
var bbcode := "_CLASS_SNAKE_CASE_"
|
||||
|
||||
|
||||
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
|
||||
var param: float = char_fx.env.get("param", 1.0)
|
||||
return true
|
8
modules/gdscript/editor/script_templates/SCsub
Normal file
8
modules/gdscript/editor/script_templates/SCsub
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
import editor.template_builders as build_template_gd
|
||||
|
||||
env.CommandNoCache("templates.gen.h", Glob("*/*.gd"), env.Run(build_template_gd.make_templates))
|
@@ -0,0 +1,51 @@
|
||||
# meta-description: Visual shader's node plugin template
|
||||
|
||||
@tool
|
||||
# Having a class name is required for a custom node.
|
||||
class_name VisualShaderNode_CLASS_
|
||||
extends _BASE_
|
||||
|
||||
|
||||
func _get_name() -> String:
|
||||
return "_CLASS_"
|
||||
|
||||
|
||||
func _get_category() -> String:
|
||||
return ""
|
||||
|
||||
|
||||
func _get_description() -> String:
|
||||
return ""
|
||||
|
||||
|
||||
func _get_return_icon_type() -> PortType:
|
||||
return PORT_TYPE_SCALAR
|
||||
|
||||
|
||||
func _get_input_port_count() -> int:
|
||||
return 0
|
||||
|
||||
|
||||
func _get_input_port_name(port: int) -> String:
|
||||
return ""
|
||||
|
||||
|
||||
func _get_input_port_type(port: int) -> PortType:
|
||||
return PORT_TYPE_SCALAR
|
||||
|
||||
|
||||
func _get_output_port_count() -> int:
|
||||
return 1
|
||||
|
||||
|
||||
func _get_output_port_name(port: int) -> String:
|
||||
return "result"
|
||||
|
||||
|
||||
func _get_output_port_type(port: int) -> PortType:
|
||||
return PORT_TYPE_SCALAR
|
||||
|
||||
|
||||
func _get_code(input_vars: Array[String], output_vars: Array[String],
|
||||
mode: Shader.Mode, type: VisualShader.Type) -> String:
|
||||
return output_vars[0] + " = 0.0;"
|
Reference in New Issue
Block a user