Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Tweaking the size and position of the textbox (sprite and otherwise) for the custcene engine.

A topic by Akawist created 28 days ago Views: 56 Replies: 7
Viewing posts 1 to 5

I am struggling with adjusting the size and the position of the textbox. I got totally lost in the scripts and cannot find a way to tweak the values so that the textbox would keep the dimensions I would like it to (I am using a nine-sliced sprite for the textbox, but that is somewhat secondary as i cannot make the adjustements regadless if i am going with a sprite or just an autogenerated textbox).
Any suggestions?

Developer

Have you tried using cutscene_dialogue_position?

Let me know if you need an example on how to use it.

I have used cutscene dialogue position. I am using the GUI layer to display the dialogue and so I wanted to refer to the viewport and or/camera to establish the size and positioning of the text box.
My viewport (as well as the camera) is 480x270 and so i wanted the textbox to be placed centrally with 20px of space from the edges of the screen (vertically) and be of a certain height.

what i am using right now is:

[cutscene_dialogue_position, 20, camera_get_view_height(view_camera[0])-20, camera_get_view_width(view_camera[0])-100, camera_get_view_height(view_camera[0])-10],
[cutscene_dialogue_style, noone, noone, c_black, noone, 0, fnt_text, spr_textbox_wide, true, example_continue1, 30, true],


It does position it weirdley however and when i tweak the values sometimes the text displays in a very weird fashion.
What would your recommended code be?

Developer

If I understand correctly and you are using Draw GUI, have you followed the instructions related to that from the manual?

The manual is a note included in the asset, but you can also see it online. See the section “Using Draw GUI”.

And if you are using Draw GUI, you don’t need to get the camera positions, so changing these to something else will probably fix it.

However, if you are not using Draw GUI, then this might be a bug, but I’m not completely sure, I will have to investigate more.

Let me know if this helps, and if you still have problems, a screenshot would help.

Developer (2 edits)

After investigating this I noticed that the camera functions don’t seem to work properly when using them in the creation code of the cutscene object. I will try to find some workaround for this in some future update, because it is kind of limiting.

Also I noticed that you were using for example camera_get_view_width(view_camera[0])-100 when it probably should be camera_get_view_x(view_camera[0])+camera_get_view_width(view_camera[0])-100. But that doesn’t matter here because it doesn’t work.

So there seems to be 2 options:

1. Use Draw GUI

You can get the result you want without the camera functions. Just follow the instructions in the manual.

2. Edit the textbox_draw script manually

For example I tried this (I kept the cutscene_dialogue_position in the cutscene, even if it doesn’t do anything, because otherwise this code doesn’t run): And it seems to work well. This only sets the position of the text box, everything else goes automatically to the correct positions. If you want to change the position of other things, you will need to add more code like this here. (I can give more examples if needed.)

Hope this helps.

Thank you so much. I’ll experiment with that. I appreciate hour help!

So, i've been experimentng with that and it still leaves me in the woods. I am not sure what am I doing wrong, however.

>I am using DrawGUI, so i have followed the instruction and changed the draw_gui parameter to true in the Draw_GUI event of the textbox object.


> My textbox_draw script now includes the code you have suggested:

> Finally, the instance triggering the cutscene on the level is as follows:

And yet when the cutscene triggers, the textbox stretched outside of the viewport, with the text itself also being drawn somewhere in the middle (I took the screenshot of my lower third of the screen and this is how it looks like when the dialogue triggers).

All the thoughts/solutions are highly appreciated.

Developer

I’m not sure if I explained it well, but use either Draw GUI OR the other option. Not both of them.

So try commenting out the code you added to the textbox_draw script. Then you can use the cutscene_dialogue_position normally (no need to use camera functions because it’s using Draw GUI).

Hopefully this clarifies things. Try it and let me know if you notice any problem.