Minor tweaks to Pong and Dodge the Creeps

This commit is contained in:
Aaron Franke
2021-07-08 00:16:41 -04:00
parent ef069d49ae
commit f71816ed31
12 changed files with 20 additions and 32 deletions

View File

@@ -83,8 +83,8 @@ public class Main : Node
direction += (float)GD.RandRange(-Mathf.Pi / 4, Mathf.Pi / 4);
mob.Rotation = direction;
// Choose the velocity.
var velocity = new Vector2((float)GD.RandRange(mob.minSpeed, mob.maxSpeed), 0);
// Choose the velocity for the mob.
var velocity = new Vector2((float)GD.RandRange(150.0, 250.0), 0);
mob.LinearVelocity = velocity.Rotated(direction);
}
}

View File

@@ -1,14 +1,7 @@
using Godot;
using System;
public class Mob : RigidBody2D
{
[Export]
public int minSpeed;
[Export]
public int maxSpeed;
public override void _Ready()
{
var animSprite = GetNode<AnimatedSprite>("AnimatedSprite");
@@ -21,9 +14,4 @@ public class Mob : RigidBody2D
{
QueueFree();
}
public void OnStartGame()
{
QueueFree();
}
}

View File

@@ -14,6 +14,8 @@ Renderer: GLES 3 (particles are not available in GLES 2)
Note: There is a GDScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/2d/dodge_the_creeps).
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/dodge_the_creeps).
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/534
## Screenshots

View File

@@ -12,6 +12,8 @@ Note: There is a GDScript version available [here](https://github.com/godotengin
Note: There is a VisualScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/visual_script/pong).
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/pong).
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/535
## How does it work?