A
AtomicToilet
Guest
Holargh!
I've written some code that works pretty well (I'm prototyping a 2D side scroller investigation thingy) except it displays the first line of text every time the player passes by the object in question. OR, it disappears after a few button clicks. Like thus:
and this (though this is far, far less common):
-----------------------------------------------------------
Here's all the relevant code!
First, in the obj_investigate
Create event:
Alarm[0] event:
Draw event:
and in the obj_player:
Create event:
Step event:
Collision with obj_investigate event:
And there we go. I've tried commentating out/switching around variables so many times now I've actually lost track. HAAALLPPPP!
I've written some code that works pretty well (I'm prototyping a 2D side scroller investigation thingy) except it displays the first line of text every time the player passes by the object in question. OR, it disappears after a few button clicks. Like thus:
and this (though this is far, far less common):
-----------------------------------------------------------
Here's all the relevant code!
First, in the obj_investigate
Create event:
Code:
first_look = true;
Code:
first_look = false;
Code:
///INVESTIGATE
//Player is next to object and presses 'Investigate' a first time
if (first_look == true) && (obj_player.investigate == true) && (obj_mouse.image_index == 2) && (obj_player.key_investigate)
{
draw_set_colour(c_white);
draw_set_font(fnt_player);
draw_set_halign( fa_center );
draw_set_valign( fa_middle );
draw_text_transformed(obj_player.x,obj_player.y-40, "Roses.",.5,.5,image_angle);
draw_text_transformed(obj_player.x,obj_player.y-30, "Not as dead as they should be.",.5,.5,image_angle);
alarm[0] = 15;
}
//Player is next to object and presses 'Investigate' a second (or third, etc) time
else if (first_look == false) && (obj_player.investigate == true) && (obj_mouse.image_index = 2) && (obj_player.key_investigate)
{
draw_set_colour(c_white);
draw_set_font(fnt_player);
draw_set_halign( fa_center );
draw_set_valign( fa_middle );
draw_text_transformed(obj_player.x,obj_player.y-40, "Which means someone",.5,.5,image_angle);
draw_text_transformed(obj_player.x,obj_player.y-30, "could still be here...",.5,.5,image_angle);
}
//These can be commented-out with no impact whatsoever (I thought they might help :( )
else if obj_player.investigate == true && !(obj_player.key_investigate)
{
//do nothing
}
else if obj_player.investigate == false
{
//do nothing
}
Create event:
Code:
investigate = false;
Code:
///INVESTIGATE
if !place_meeting(x,y,obj_investigate)
{
next_to = false;
}
Code:
if (key_investigate)
{
investigate = true;
}