Help Starting Off Coding

C

connor1409

Guest
Hi, I am quite new to GameMaker and I needed this for an assignment due in about two weeks time. I need some quick expertise in coding. What I am looking for is how to code an object to disappear after the player has typed what the object is. So for example I have a banana on the screen and a text area. I want the player to type the word 'banana' into the text area which in turn makes the banana disappear. Any help will be great.

Thanks

connor1409
 

Christian

Member
keyboard_string or get_string will be your friend for the text area. (get_string and get_string_async should only be used for debug purposes).
other string commands might be helpful, but may not be necessary

instance_deactivate, image_alpha, or alpha will be your friend for the disappearing act.

Throw in some if statements and you're good to go.
 
Last edited:

TDSrock

Member
Now because it's an assignment, I don't think it would be fair for anyone here to do the work for you, but hopefully this will get you pointed in the right direction.
I don't see how it being an assignment or not has an affect on someone helping to do the work for the person being helped, I simply always have the person do as much as possible and try to only stick to pointers and explanations that are separate but still enough to understand the core principal.
 
H

Heat4Life

Guest
READ the Official GM:S Manual because there Is a lot of Info there that you might need...
 

TDSrock

Member
READ the Official GM:S Manual because there Is a lot of Info there that you might need...
Cutting through all of it will be quite the chore. Build what you need. If you get stuck google: "gamemaker" *function you need*
With the quotes and you are bound to find what you need.
 
If I understand what you want to accomplish, being, there's a bunch of different instances of different items (like 'banana') on the screen, and you wish for specific ones to get destroyed when the user types it's name in. I would accomplish this like this (psuedoish code);

1. Add the instances to a ds_map with the 'key' being the word to be typed ('banana') and the value being the instance ID
2. Capture the input via keyboard_string
3. When the player is done typing, check for the input in the ds_map
4. If the input matches a key in the ds_map, destroy the instance stored in that key and remove the key from the map
5. Repeat as needed
 
Top