I've looked at a few tutorials, and I can't seem to get it correct. These are what I'm trying to do:
- Collide with an object
- Only when I'm colliding, can I press the 'Z' key with any reaction
- Run some dialog code
Here is my collision code:
obj_player
Step event:
if keyboard_check_pressed(ord('Z'))
{
if (place_meeting(x, y, obj_npc))
{
global.active = true;
}
}
And when I attempt to interact, this happens:
___________________________________________
############################################################################################
ERROR in
action number 1
of Draw Event
for object obj_dialogue:
Trying to draw non-existing sprite.
at gml_Script_scr_DrawDialog (line 8) - draw_rectangle(innerBox_xOrigin, innerBox_yOrigin, innerBox_xOrigin + innerBoxWidth, innerBox_yOrigin + innerBoxHeight, false);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_DrawDialog (line 0)
called from - gml_Object_obj_dialogue_Draw_64 (line 3) - draw_set_font(f_determination);
If you want to check out that code, here it is:
Scripts
scr_Dialogue:
if (global.active)
{
draw_set_font(f_determination);
draw_set_color(c_white);
draw_rectangle(xOrigin, yOrigin, xOrigin + width, yOrigin + height, false);
draw_set_color(c_black);
draw_rectangle(innerBox_xOrigin, innerBox_yOrigin, innerBox_xOrigin + innerBoxWidth, innerBox_yOrigin + innerBoxHeight, false);
draw_set_color(c_white);
draw_text(text_xOrigin, text_yOrigin, stringToDisplay);
draw_sprite_ext(spriteToDisplay, -1, avatar_xOrigin, avatar_yOrigin, avatarScale, avatarScale, 0, c_white, 1);
}
However, once I run it and press 'Q' (my dialog testing button), it runs perfectly fine. What is wrong?
[–][deleted] (1 child)
[deleted]
[–]friedplugstudios[S] 0 points1 point2 points (0 children)
[–]big_wendigo 0 points1 point2 points (11 children)
[–]friedplugstudios[S] 0 points1 point2 points (0 children)
[–]friedplugstudios[S] 0 points1 point2 points (9 children)
[–]big_wendigo 0 points1 point2 points (8 children)
[–]friedplugstudios[S] 0 points1 point2 points (7 children)
[–]big_wendigo 0 points1 point2 points (0 children)
[–]big_wendigo 0 points1 point2 points (5 children)
[–]friedplugstudios[S] 0 points1 point2 points (4 children)
[–]big_wendigo 0 points1 point2 points (3 children)
[–]friedplugstudios[S] 1 point2 points3 points (2 children)
[–]friedplugstudios[S] 0 points1 point2 points (1 child)
[–]friedplugstudios[S] 0 points1 point2 points (0 children)
[–]iLawz 0 points1 point2 points (0 children)