Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Placing items  (Read 4459 times)

0 Members and 1 Guest are viewing this topic.

timbliz

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Placing items
« on: March 10, 2017, 07:53:07 PM »

Hello everyone!

I've been making a first-person adventure, and up until now, if I couldn't find the answer to a problem here I've been able to trial-and-error my way to a solution. This is satisfying, but often it is time consuming! My problem now might really be just a matter of opinion, but I'd like to know the best way to handle it. In my game I have a safe with three keyholes. In my inventory I have three keys, a red, a blue, and a green. For the safe to open, the correct key must be placed in the correct keyhole in the correct order e.g. first move: green key in bottom keyhole , second move: red key in top keyhole, third move: blue key in middle keyhole. The logic to this should not be a problem, but I am not sure the best way to place the keys back in the scene from the inventory as each key should be able to go into any keyhole (for all the incorrect permutations). Do I stack three !Active sprite entities above each keyhole? Or maybe just one sprite entity and set its sprite image accordingly on red_key, blue_key, green_key events? Or set different frames of one sprite entity to the different color key images and call the corresponding frame to display (if that can even be done)?


This leads me to another related question, when I had to place a single inventory item back in the scene, I set an !Active sprite entity where it needed to be, and then I had to set an area entity over the same space since the mouse won't detect the !Active sprite entity. Is this the way to handle the situation? It doesn't seem elegant to me. From what I gather, entities can be visible and interactive, visible and !interactive, or !visible and !interactive, but not !visible and interactive, is this the case?

Thanks in advance guys, and for the million other questions you already answered for me on these boards.
Logged

timbliz

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Placing items
« Reply #1 on: March 11, 2017, 03:36:30 AM »

I went with my first option, it works, but with 12 entities for 3 keyholes (3 key sprites and 1 area sprite for each keyhole)  I was just wondering if there was a better/simpler way.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Placing items
« Reply #2 on: March 11, 2017, 10:04:31 AM »

Keep in mind entities don't have to be placed in SceneEdit. You can load entities from file at runtime (from a script). Which is the approach I would use in this case. Of course, it's not as comfortable as using SceneEdit, because you'd need to hardcode the entity positions in the script.

As for your other question, using a separate region entity for interaction when the key is not visible is a good approach, IMO. It makes sense, if the key isn't there, you're not interacting with a key, you're interacting with a keyhole, so a keyhole should have it's own entity/script/interaction logic.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.254 seconds with 24 queries.