mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
Minor tweaks to Pong and Dodge the Creeps
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user