I need help with a simple assignment.

Started by N3cropolis 11, Mon 01/05/2017 01:36:14

Previous topic - Next topic

N3cropolis 11

Hi guys! So uh, I got my pops over here and he wants me to make it so that when you put your cursor onto something it comes up (in my case, text). Is there any way to make it so that just even a simple box comes up? EG: If I put my cursor over a lamp, some text comes up saying: "What an odd looking lamp." or describing what is near it or what it is. Script would be nice for this assignment.

UPDATE: There's now an error for my room that says: The game is set to start in room -1 which does not exist.

How do I fix this problem? Please help. And how do I make my character?

dayowlron

I am assuming you already have a room.
You need at least 1 character (the player)
Create and import at least one sprite for the character.
Assign the sprite to a view.
Then set the characters normal view to be that view and the characters starting room to be one of the rooms you created.

As far as showing text in the room you would have to have hotspots and/or objects for each of the areas then you can get the hotspot or object under the cursor and have the player Think the text.
I am not totally sure of the code, however this is what you need to do.
Code: ags

 if (GetLocationType(mouse.x, mouse.y) == eLocationHotspot) {
      Hotspot *hs = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
      if (hs == hLamp) player.Think("What an odd looking lamp.");
 }
 else if (GetLocationType(mouse.x, mouse.y) == eLocationObject) {
      Object *o = Object.GetAtScreenXY(mouse.x, mouse.y);
      if (o==oDoor) player.Think("The door is closed.");
 }


Also, I believe the mods here would like if you have 2 questions to make 2 different threads.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Khris

N3cropolis, did you look at the tutorial in the manual yet? Just press F1 while the editor is open, and in the Contents section, open the tutorial folder.

The error you got probably means you're starting with the "Empty game" template, I recommend to use the "Default game" instead while you're learning the ropes.
Here's a list of youtube videos showing how to implement the most common game mechanics: https://www.youtube.com/playlist?list=PL21DB402CB4DAEAEF

SMF spam blocked by CleanTalk