Comunidad Game Maker

Ayuda => Preguntas y respuestas => Mensaje iniciado por: nonoroman en Mayo 15, 2017, 11:41:02 PM

Título: TEXTO QUE SUBE OTRAS VECES BAJA
Publicado por: nonoroman en Mayo 15, 2017, 11:41:02 PM
Bueno, pues ultimamente, me ocurren cosas rarisimas.

Resulta que tengo un texto que imprimiendose poco a poco. Hasta aqui todo perfecto.

Pues bueno, si lo pruebo en la primera room del juego, funciona correctamente, porque el texto continua imprimiendose hacia abajo, ahora, si lo pruebo en la ultima room, el texto se va imprimiendo hacia arriba.

POR TODA LA CARA!!! por mas que lo he mirado no entiendo porque ocurre esto.  ???

os dejo el codigo por si alguien ve algo;

Information about object: obj_text_typer
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

set variable all_text to "ACCESO 46#Sistema de seguridad de puertas# - Scanlines (Optional)# - Green screen (Optional)# - Screen 'shut down' effect (Optional)# - Plus this text-typewriter##...all in an efficient GPU shader with#negligible CPU overhead!"
set variable font to fnt_hud_values
set variable char_display_count to 0
set variable chars_per_second to 8
set variable ticks to 0
Step Event:

execute code:

/// Reveal text.
ticks++;
char_display_count = ticks * chars_per_second / room_speed;


Other Event: Room Start:

execute code:

/// Prepare display text.
char_display_count = 0;
char_increment_per_tick = room_speed;


Draw Event:

execute code:

/// Display message text.
draw_set_halign(fa_center);
draw_set_font(font);
draw_set_colour(c_lime);

// Display text.
var text = string_copy(all_text, 1, floor(char_display_count));
draw_text(view_wview[0]/2, y, text);

// Find caret position.
var line_count = 1;
var pos = string_pos("#", text);
while (pos > 0)
{
    text = string_delete(text, 1, pos);
    line_count++;
    pos = string_pos("#", text);
}

// Draw caret.
var line_height = string_height(" ");
var x1 = view_wview[0]/2 + string_width(text);
var y1 = view_hview[0]/6 + line_height * (line_count - 1);

draw_set_alpha(sin(ticks / room_speed * 3.141)); // 'Pulse'
draw_rectangle(x1, y1, x1 + string_width(" "), y1 + line_height, false);
draw_set_alpha(1.0);

draw_text(20,10,char_display_count);
//draw_text(20,20,y1);

// Display text.