Skip to content

Commit f71816e

Browse files
committed
Minor tweaks to Pong and Dodge the Creeps
1 parent ef069d4 commit f71816e

File tree

12 files changed

+20
-32
lines changed

12 files changed

+20
-32
lines changed

2d/dodge_the_creeps/Main.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func _on_MobTimer_timeout():
4444
direction += rand_range(-PI / 4, PI / 4)
4545
mob.rotation = direction
4646

47-
# Choose the velocity.
48-
var velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0)
47+
# Choose the velocity for the mob.
48+
var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
4949
mob.linear_velocity = velocity.rotated(direction)
5050

5151

2d/dodge_the_creeps/Mob.gd

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
extends RigidBody2D
22

3-
#warning-ignore-all:unused_class_variable
4-
export var min_speed = 150
5-
export var max_speed = 250
6-
73
func _ready():
84
$AnimatedSprite.playing = true
95
var mob_types = $AnimatedSprite.frames.get_animation_names()
@@ -12,7 +8,3 @@ func _ready():
128

139
func _on_VisibilityNotifier2D_screen_exited():
1410
queue_free()
15-
16-
17-
func _on_start_game():
18-
queue_free()

2d/dodge_the_creeps/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Renderer: GLES 3 (particles are not available in GLES 2)
1414

1515
Note: There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps).
1616

17+
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/dodge_the_creeps).
18+
1719
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/515
1820

1921
## Screenshots

2d/pong/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Note: There is a C# version available [here](https://github.com/godotengine/godo
1212

1313
Note: There is a VisualScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/visual_script/pong).
1414

15+
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/pong).
16+
1517
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/121
1618

1719
## How does it work?

2d/pong/logic/ball.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ extends Area2D
22

33
const DEFAULT_SPEED = 100
44

5+
var _speed = DEFAULT_SPEED
56
var direction = Vector2.LEFT
67

78
onready var _initial_pos = position
8-
onready var _speed = DEFAULT_SPEED
99

1010
func _process(delta):
1111
_speed += delta * 2

3d/voxel/settings.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var _loaded = false
1212
func _enter_tree():
1313
if Settings._loaded:
1414
printerr("Error: Settings is an AutoLoad singleton and it shouldn't be instanced elsewhere.")
15-
printerr("Please delete the instance at: " + get_path())
15+
printerr("Please delete the instance at: " + String(get_path()))
1616
else:
1717
Settings._loaded = true
1818

mono/dodge_the_creeps/Main.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ public void OnMobTimerTimeout()
8383
direction += (float)GD.RandRange(-Mathf.Pi / 4, Mathf.Pi / 4);
8484
mob.Rotation = direction;
8585

86-
// Choose the velocity.
87-
var velocity = new Vector2((float)GD.RandRange(mob.minSpeed, mob.maxSpeed), 0);
86+
// Choose the velocity for the mob.
87+
var velocity = new Vector2((float)GD.RandRange(150.0, 250.0), 0);
8888
mob.LinearVelocity = velocity.Rotated(direction);
8989
}
9090
}

mono/dodge_the_creeps/Mob.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
using Godot;
2-
using System;
32

43
public class Mob : RigidBody2D
54
{
6-
[Export]
7-
public int minSpeed;
8-
9-
[Export]
10-
public int maxSpeed;
11-
125
public override void _Ready()
136
{
147
var animSprite = GetNode<AnimatedSprite>("AnimatedSprite");
@@ -21,9 +14,4 @@ public void OnVisibilityScreenExited()
2114
{
2215
QueueFree();
2316
}
24-
25-
public void OnStartGame()
26-
{
27-
QueueFree();
28-
}
2917
}

mono/dodge_the_creeps/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Renderer: GLES 3 (particles are not available in GLES 2)
1414

1515
Note: There is a GDScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/2d/dodge_the_creeps).
1616

17+
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/dodge_the_creeps).
18+
1719
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/534
1820

1921
## Screenshots

mono/pong/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Note: There is a GDScript version available [here](https://github.com/godotengin
1212

1313
Note: There is a VisualScript version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/visual_script/pong).
1414

15+
Note: There is a GDNative C++ version available [here](https://github.com/godotengine/gdnative-demos/tree/master/cpp/pong).
16+
1517
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/535
1618

1719
## How does it work?

0 commit comments

Comments
 (0)