Drag and drop works
This commit is contained in:
51
Letterbox.cs
51
Letterbox.cs
@@ -1,28 +1,33 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class Letterbox : Node2D
|
||||
namespace lettergodot
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
// assign random letters to all the child nodes of type Letter
|
||||
foreach (var letter in GetChildren())
|
||||
{
|
||||
if (letter is Letter)
|
||||
{
|
||||
((Letter)letter).Value = RandomLetterAsAString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// method that returns a string with a random capital letter inside
|
||||
private string RandomLetterAsAString()
|
||||
{
|
||||
var random = new Random();
|
||||
var randomLetter = (char)random.Next('A', 'Z' + 1);
|
||||
return randomLetter.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Letterbox : Node2D
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
// assign random letters to all the child nodes of type Letter
|
||||
foreach (var letter in GetChildren())
|
||||
{
|
||||
if (letter is Letter)
|
||||
{
|
||||
((Letter)letter).Value = RandomLetterAsAString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// method that returns a string with a random capital letter inside
|
||||
private string RandomLetterAsAString()
|
||||
{
|
||||
var random = new Random();
|
||||
var randomLetter = (char)random.Next('A', 'Z' + 1);
|
||||
return randomLetter.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user