Wintermute Engine > Technical forum

Text and voice scene. Lock movement in the x-axis or keyboard control?

(1/3) > >>

Indra Anagram:
Hey Wintermute community!

I searched through this forum and only found partial answers to my questions, that is why I decided to ask them here, in the new topic.

1. What is the easiest and smoothest way to create a scene with just text on screen and voice behind, maybe with some background image or just against black screen? I found an advice about making a text window and then unloading it, but what about text AND voice (talk)?

2. Is there a way to kinda lock actors' movement in the x-axis, so that they moved in a straight horizontal line, without swaying up and down in the y-axis? The point is there won't be any depth in my game, everything's pretty flat. Previously I asked this in one of the previous topics and anarchist shared a brilliant idea of making two blocked regions with a narrow walking path between them for actors. Still, sometimes I notice actor sprites do sway up and down a bit within that walking stripe. Is there a code to ban actors from moving in the y-axis at all or is keyboard control with LEFT and RIGHT keys the only way to provide movement in a perfect horizontal line?

What do you think? Maybe someone has already solved such things in their games?

THANK YOU for your ideas and experience!
 

anarchist:
(1) What I did was create an empty scene and then:

In scene_init.script


--- Code: WME Script ---Game.FadeOut(0);Game.Interactive = false;var YourWindow = Game.LoadWindow("interface\YourWindow\YourWindow.window");YourWindow.Center();Game.FadeIn(2000);Game.Interactive = true; 
Then, in YourWindow.script


--- Code: WME Script ---#include "scripts\base.inc"#include "scripts\keys.inc" Game.PlayMusicChannel(0, "your_sound_file.ogg", true); 
YourWindow should be sized so that it covers the whole scene.

NAItReIN:
Hi guys  :)


--- Quote ---1. What is the easiest and smoothest way to create a scene with just text on screen and voice behind, maybe with some background image or just against black screen? I found an advice about making a text window and then unloading it, but what about text AND voice (talk)?
--- End quote ---

As anarchist wrote you can do it with window. But be sure there is also other way how to achieve this.
1. Add new entity to your project, for example entities\speaker\speaker.entity
You can set subtitles possition as you wish.
If you want to have an invisible entity you can use only one bitmap with pink color. This makes the sprite invisible.

SubtitlesPosRelativeSpecifies whether the SubtitlesPosX and SubtitlesPosY attributes are relative to default position, or absolute screen coordinatesSubtitlesPosXThe X position of speech subtitles (either relative to speaker's position or absolute screen coordinates)SubtitlesPosYThe Y position of speech subtitles (either relative to speaker's position or absolute screen coordinates)SubtitlesWidthWidth of speech subtitles. Set to zero to restore the default behavior.SubtitlesPosXCenterSpecifies if the SubtitlesPosX attribute affects the center of the subtitle or its left side.For futher information see WME Documentation, section Scripting in WME, Script language reference and at last Entity object.

Now open your scene_init.script and load your entity to your current scene. Note: you donĀ“t need to unload entity from memory because when you leave current scene the game will unload your entity automatically.


--- Code: WME Script ---// we want an invisible speakervar entSpeaker = Scene.LoadEntity("entities\speaker\speaker.entity");entSpeaker.Talk("Hi Indra Anagram, how are you today?");

Indra Anagram:
Hey anarchist!

I am sorry for being slow with reply.


--- Quote from: anarchist on November 29, 2017, 10:24:57 PM ---In scene_init.script


--- Code: WME Script ---Game.FadeOut(0);Game.Interactive = false;var YourWindow = Game.LoadWindow("interface\YourWindow\YourWindow.window");YourWindow.Center();Game.FadeIn(2000);Game.Interactive = true; 
--- End quote ---

I created a window that covers the whole screen and followed every step of your detailed advice. The only problem I encountered was YourWindow.Center(); line. As Debugging console says:


--- Quote ---0:42:19:  Maximum texture size: 4096x4096
0:42:19:  Engine initialized in 81 ms
0:42:19: 
0:42:20:  'WINDOW' keyword expected.
0:42:20:  Error parsing WINDOW file 'interface\YourWindow\YourWindow.window'
0:42:20:  Runtime error. Script 'scenes\Text1\scr\scene_init.script', line 30
0:42:20:    Call to undefined method 'Center'. Ignored.
--- End quote ---

What is the function of 'Center' in this code? How do I define it?

THANK YOU for your kind help, anarchist!

Indra Anagram:
Hello, NAItReIN!

I am sorry it took me so long to answer your message. I created an invisible entity, just like you wrote and it worked. As I run the scene, text appears at the top of screen. However, I've got two questions:


--- Quote from: NAItReIN on November 30, 2017, 02:42:53 PM ---SubtitlesPosRelativeSpecifies whether the SubtitlesPosX and SubtitlesPosY attributes are relative to default position, or absolute screen coordinatesSubtitlesPosXThe X position of speech subtitles (either relative to speaker's position or absolute screen coordinates)SubtitlesPosYThe Y position of speech subtitles (either relative to speaker's position or absolute screen coordinates)SubtitlesWidthWidth of speech subtitles. Set to zero to restore the default behavior.SubtitlesPosXCenterSpecifies if the SubtitlesPosX attribute affects the center of the subtitle or its left side.For futher information see WME Documentation, section Scripting in WME, Script language reference and at last Entity object.

--- End quote ---

1. Where do I specify SubtitlesPosX etc.? What file should it be in?
2. How do I play the voice file at the same time with the text being on screen?

THANK YOU, NAItReIN! You and anarchist are amazing. Seriously, guys.

Navigation

[0] Message Index

[#] Next page

Go to full version