Skip to content

Commit 2eb2a9b

Browse files
committed
Merge branch 'S1P4_Develop' into main
2 parents 162e668 + bc521db commit 2eb2a9b

34 files changed

+504
-69
lines changed

Lessons/1/User/ThreeStar.sfc

0 Bytes
Binary file not shown.

Lessons/1/User/TwoStar.sfc

0 Bytes
Binary file not shown.

Lessons/3/User/Diagram_Full.sfc

0 Bytes
Binary file not shown.

Lessons/3/User/Diagram_Sensor.sfc

0 Bytes
Binary file not shown.

Lessons/3/User/Diagram_Timed.sfc

0 Bytes
Binary file not shown.

data/core/bubbles/BubbleSprite.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using Godot;
2+
3+
4+
namespace Osls.Bubbles
5+
{
6+
public class BubbleSprite : Sprite3D
7+
{
8+
#region ==================== Fields / Properties ====================
9+
public enum Bubble { Say, Think, Shout, None }
10+
public enum Expression { Attention, Exclamation, Confused, Surprised, Ok, Nok, Sleeping, Annoyed, Angry, Frustrated, Loving, Happy, Sad, Laughing, Busy, Depressed, Dizzy, Home, Idea, Money, Music, Waiting }
11+
12+
private const int LineOffset = 4;
13+
private float _remainingTime;
14+
private bool _importantDisplay;
15+
16+
/// <summary>
17+
/// Cumulated time in s from the last activation
18+
/// </summary>
19+
public float TimeSinceLastActivation { get; private set; }
20+
#endregion
21+
22+
23+
#region ==================== Public Methods ====================
24+
/// <summary>
25+
/// Shows the 3dSprite with the bubble type and expression for the given time [s] and then hides again.
26+
/// </summary>
27+
public void ShowAs(Bubble bubble, Expression expression, float time, bool important = false)
28+
{
29+
if (_importantDisplay && ! important) return;
30+
_importantDisplay = important;
31+
int y = (int)bubble * LineOffset + (int)expression / Hframes;
32+
int x = (int)expression % Hframes;
33+
FrameCoords = new Vector2(x, y);
34+
_remainingTime = time;
35+
TimeSinceLastActivation = 0;
36+
Visible = true;
37+
}
38+
39+
public override void _Process(float delta)
40+
{
41+
if (Visible)
42+
{
43+
_remainingTime -= delta;
44+
if (_remainingTime < 0)
45+
{
46+
Visible = false;
47+
_importantDisplay = false;
48+
}
49+
}
50+
TimeSinceLastActivation += delta;
51+
}
52+
#endregion
53+
}
54+
}

data/core/bubbles/BubbleSprite.tscn

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[gd_scene load_steps=3 format=2]
2+
3+
[ext_resource path="res://data/core/bubbles/import/BubblesT.png" type="Texture" id=1]
4+
[ext_resource path="res://data/core/bubbles/BubbleSprite.cs" type="Script" id=2]
5+
6+
[node name="BubbleSprite" type="Sprite3D"]
7+
modulate = Color( 0.862745, 0.862745, 0.862745, 1 )
8+
pixel_size = 0.04
9+
billboard = 2
10+
double_sided = false
11+
alpha_cut = 1
12+
texture = ExtResource( 1 )
13+
hframes = 16
14+
vframes = 16
15+
script = ExtResource( 2 )

data/core/bubbles/import/BubblesT.png

21.7 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/BubblesT.png-eb137043f305b448b3226ace9a24a9bc.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://data/core/bubbles/import/BubblesT.png"
13+
dest_files=[ "res://.import/BubblesT.png-eb137043f305b448b3226ace9a24a9bc.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=2
22+
flags/repeat=0
23+
flags/filter=false
24+
flags/mipmaps=true
25+
flags/anisotropic=true
26+
flags/srgb=1
27+
process/fix_alpha_border=false
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
stream=false
32+
size_limit=0
33+
detect_3d=false
34+
svg/scale=1.0

data/core/environment/EnvironmentPaths.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static string LessonsFolderPath
99
{
1010
get
1111
{
12-
return Godot.ProjectSettings.GlobalizePath("res://Lessons/");
12+
return Godot.ProjectSettings.GlobalizePath("res://lessons/");
1313
}
1414
}
1515
}

0 commit comments

Comments
 (0)