Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
fixed bug in the face position that could crash SMRT
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosxs committed Jun 26, 2017
1 parent a6a05b2 commit 3ca10cc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions SMRT/dialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ func show_text(chapter, dialog, start_at = 0):
side = dialog_array[start_at].face_position

face.show()
texture_width = face.get_sprite_frames().get_frame(face.get_animation(), face.get_frame()).get_width()
texture_height = face.get_sprite_frames().get_frame(face.get_animation(), face.get_frame()).get_height()
texture_width = face.get_sprite_frames().get_frame(face.get_animation(), face.get_frame()).get_width()
texture_height = face.get_sprite_frames().get_frame(face.get_animation(), face.get_frame()).get_height()
# Side of the dialog to display the face
# RESETING THE DIALOG
text = dialog_array[start_at].text
Expand Down Expand Up @@ -284,7 +284,8 @@ func show_text(chapter, dialog, start_at = 0):

elif position==2:
self.set_pos(Vector2(0,screen_res.size.y-(get_size().y)))
face_v_pos = get_size().height/2 - (texture_height/2)
var size = get_size().x
face_v_pos = get_size().y/2 - (texture_height/2)
if show_debug_messages:
print("FACE V POS ", face_v_pos)
if side == 0:
Expand Down
2 changes: 1 addition & 1 deletion SMRT/example.lan
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"INTRO":{"Freddie":[{"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"Don't stop me now!", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":2, "face_frame":1}, {"answers":[], "beep_pitch":0.1, "face_position":0, "beep":true, "text":"Mother... just killed a man", "enable_question":false, "typewriter_speed":0.1, "typewriter":true, "frame_position":2, "face_frame":1}], "OLD MAN":[{"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"This is a little example file for SMRT-Godot!", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":0, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"Who am I you ask?", "enable_question":false, "typewriter_speed":0.05, "typewriter":false, "frame_position":0, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":2, "beep":true, "text":"It'za me Mario!", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":0, "face_frame":1}, {"answers":["Let's go!", "Yup, let's go!", "Nope."], "beep_pitch":1, "face_position":1, "beep":true, "text":"Shall we begin demonstrating what can be done with [color=#ff0000]SMRT[/color]ness?", "enable_question":true, "typewriter_speed":0.05, "typewriter":true, "frame_position":0, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"So... we can make this go slower", "enable_question":false, "typewriter_speed":0.1, "typewriter":true, "frame_position":1, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"And yes, appearing on the middle of the screen as you probably noticed.", "enable_question":false, "typewriter_speed":0.052353, "typewriter":true, "frame_position":2, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"We can color our [color=#0062ff]L[/color][color=#58ff00]E[/color][color=#b400ff]T[/color][color=#eaff00]T[/color][color=#2c762b]E[/color][color=#7c72ad]R[/color][color=#975f30]S[/color] any RGB color we wish!", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":1, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"We can also change the pitch of the sound so we can give it more character.", "enable_question":false, "frame_position":1, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"face_position":0, "beep_pitch":4, "answers":[], "beep":true, "text":"Like this", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.105906, "face_frame":1}, {"face_position":0, "beep_pitch":0.5, "answers":[], "beep":true, "text":"Or this", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.105906, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"So... yeah... go on...", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":2, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"Try moving the logo with the arrow keys towards the other logo to see another example!", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}], "NPC1":[{"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"Hi there!", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"I am a little NPC... a very simple one.", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}]}}
{"INTRO":{"OLD MAN":[{"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"This is a little example file for SMRT-Godot!", "enable_question":false, "frame_position":0, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"Who am I you ask?", "enable_question":false, "frame_position":0, "typewriter":false, "typewriter_speed":0.05, "face_frame":1}, {"face_position":2, "beep_pitch":1, "answers":[], "beep":true, "text":"It'za me Mario!", "enable_question":false, "frame_position":0, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"face_position":1, "beep_pitch":1, "answers":["Let's go!", "Yup, let's go!", "Nope."], "beep":true, "text":"Shall we begin demonstrating what can be done with [color=#ff0000]SMRT[/color]ness?", "enable_question":true, "frame_position":0, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"So... we can make this go slower", "enable_question":false, "frame_position":1, "typewriter":true, "typewriter_speed":0.1, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"And yes, appearing on the middle of the screen as you probably noticed.", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.052353, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"We can color our [color=#0062ff]L[/color][color=#58ff00]E[/color][color=#b400ff]T[/color][color=#eaff00]T[/color][color=#2c762b]E[/color][color=#7c72ad]R[/color][color=#975f30]S[/color] any RGB color we wish!", "enable_question":false, "frame_position":1, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"We can also change the pitch of the sound so we can give it more character.", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":1, "face_frame":1}, {"answers":[], "beep_pitch":4, "face_position":0, "beep":true, "text":"Like this", "enable_question":false, "typewriter_speed":0.105906, "typewriter":true, "frame_position":2, "face_frame":1}, {"answers":[], "beep_pitch":0.5, "face_position":0, "beep":true, "text":"Or this", "enable_question":false, "typewriter_speed":0.105906, "typewriter":true, "frame_position":2, "face_frame":1}, {"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"So... yeah... go on...", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"Try moving the logo with the arrow keys towards the other logo to see another example!", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":2, "face_frame":1}], "Freddie":[{"face_position":0, "beep_pitch":1, "answers":[], "beep":true, "text":"Don't stop me now!", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.05, "face_frame":1}, {"face_position":0, "beep_pitch":0.1, "answers":[], "beep":true, "text":"Mother... just killed a man", "enable_question":false, "frame_position":2, "typewriter":true, "typewriter_speed":0.1, "face_frame":1}], "NPC1":[{"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"Hi there!", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":2, "face_frame":1}, {"answers":[], "beep_pitch":1, "face_position":0, "beep":true, "text":"I am a little NPC... a very simple one.", "enable_question":false, "typewriter_speed":0.05, "typewriter":true, "frame_position":2, "face_frame":1}]}}
3 changes: 2 additions & 1 deletion SMRT/faces/dialog.tres
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
[ext_resource path="res://addons/SMRT/faces/faces2.png" type="Texture" id=1]
[ext_resource path="res://addons/SMRT/faces/faces1.png" type="Texture" id=2]
[ext_resource path="res://addons/SMRT/faces/faces3.png" type="Texture" id=3]
[ext_resource path="res://examples/cave/characters/face.png" type="Texture" id=4]

[resource]

animations = [ { "frames":[ ExtResource( 1 ), ExtResource( 2 ), ExtResource( 3 )], "loop":true, "name":"default", "speed":5.0 } ]
animations = [ { "frames":[ ExtResource( 1 ), ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ) ], "loop":true, "name":"default", "speed":5.0 } ]

2 changes: 1 addition & 1 deletion SMRT/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name="SMRT"
description="SMRT is a dialog system for godot"
author="BrunoSXS"
version="1.2.1"
version="1.2.2"
script="SMRT.gd"


Expand Down

0 comments on commit 3ca10cc

Please sign in to comment.