files
This commit is contained in:
9
Mal-Adresse.csproj
Normal file
9
Mal-Adresse.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.3.0">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
<RootNamespace>MalAdresse</RootNamespace>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
19
Mal-Adresse.sln
Normal file
19
Mal-Adresse.sln
Normal file
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mal-Adresse", "Mal-Adresse.csproj", "{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
ExportDebug|Any CPU = ExportDebug|Any CPU
|
||||
ExportRelease|Any CPU = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||
{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||
{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||
{4E1911F5-B16F-455B-B3BB-FC9BBCC6D57E}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -14,6 +14,11 @@ config/name="Mal-Adresse"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=266
|
||||
window/size/viewport_height=200
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="Mal-Adresse"
|
||||
|
||||
3
scene/city.tscn
Normal file
3
scene/city.tscn
Normal file
@@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://1tfopbwug3ht"]
|
||||
|
||||
[node name="city" type="Node2D"]
|
||||
16
scene/player.tscn
Normal file
16
scene/player.tscn
Normal file
@@ -0,0 +1,16 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://4ubk6w44h4s2"]
|
||||
|
||||
[ext_resource type="Script" path="res://script/Player.cs" id="1_gmlsd"]
|
||||
[ext_resource type="Texture2D" uid="uid://c0vb33qqa2u1u" path="res://icon.svg" id="2_7ko2y"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5g3cc"]
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D"]
|
||||
script = ExtResource("1_gmlsd")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_5g3cc")
|
||||
|
||||
[node name="Icon" type="Sprite2D" parent="."]
|
||||
position = Vector2(1, 0)
|
||||
texture = ExtResource("2_7ko2y")
|
||||
34
script/Player.cs
Normal file
34
script/Player.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Player : CharacterBody2D
|
||||
{
|
||||
public const float Speed = 300.0f;
|
||||
public const float JumpVelocity = -400.0f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Vector2 velocity = Velocity;
|
||||
|
||||
// Handle Jump.
|
||||
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
|
||||
{
|
||||
velocity.Y = JumpVelocity;
|
||||
}
|
||||
|
||||
// Get the input direction and handle the movement/deceleration.
|
||||
// As good practice, you should replace UI actions with custom gameplay actions.
|
||||
Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
|
||||
if (direction != Vector2.Zero)
|
||||
{
|
||||
velocity.X = direction.X * Speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
|
||||
}
|
||||
|
||||
Velocity = velocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user