L
LaLaurien
Guest
Hello everyone,
I am currently working on a Point and Click Adventure in GM2.
As I am still new to GML I am having quite a few problems with the coding language.
Some of you might know, that clicking on an item usually triggers a text in Point and Clicks.
At the moment I coded it this way:
The item (obj_item) has a mouse left clicked event:
instance_create_depth (x,y,depth, text_item)
The text_item object now has a draw event:
draw_text (x,y @"This is an item");
The object also has an alarm, which makes the text disappear afer a certain time.
Create event of text_item:
alarm[0] = 240;
Alarm event:
instance_destroy();
Now I have already added all items to the game, which are quite a lot.
And since I trigger an individual text item for each item, this causes me to have
hundreds of text objects. All just containing one difference:
the description in the string in the draw_text event.
Now i thought I could just make ONE object, which contains all explanations.
However, I have no idea how to code this logicially.
I thought about using an array, but I just now learned about their existence and
still dont quite understand how an array can help me here.
How does the item draw the individual text?
Doesnt a draw event always trigger as soon as the object is created?
Thank you for your help beforehand!
I am currently working on a Point and Click Adventure in GM2.
As I am still new to GML I am having quite a few problems with the coding language.
Some of you might know, that clicking on an item usually triggers a text in Point and Clicks.
At the moment I coded it this way:
The item (obj_item) has a mouse left clicked event:
instance_create_depth (x,y,depth, text_item)
The text_item object now has a draw event:
draw_text (x,y @"This is an item");
The object also has an alarm, which makes the text disappear afer a certain time.
Create event of text_item:
alarm[0] = 240;
Alarm event:
instance_destroy();
Now I have already added all items to the game, which are quite a lot.
And since I trigger an individual text item for each item, this causes me to have
hundreds of text objects. All just containing one difference:
the description in the string in the draw_text event.
Now i thought I could just make ONE object, which contains all explanations.
However, I have no idea how to code this logicially.
I thought about using an array, but I just now learned about their existence and
still dont quite understand how an array can help me here.
How does the item draw the individual text?
Doesnt a draw event always trigger as soon as the object is created?
Thank you for your help beforehand!