point&click events

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
S-Rave
Prole
Posts: 39
Joined: Wed Feb 25, 2009 4:41 pm

point&click events

Post by S-Rave »

Hey. Zup. Good day.

I'm making a point&click game and I need some help with what events I would need for game events.

Currently I have
  • Show a message
  • Wait
  • Move actor
  • Set actor visibility
  • Parallel (run sequences at the same time)
  • Sequence (a queue of events)
I'm probably going to implement
  • Add/Remove inventory
  • Get/Set switches
  • Play/stop sound
  • Play/stop music
  • Teleport
  • Start/Stop animation
Any good ideas or pointers?
Maybe move the camera, but the camera could be an actor as well and use that event.
srejv
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: point&click events

Post by Taehl »

I would suggest something which is full of interaction. Enemies are the standard choice, but you could also go with environmental puzzles, items which can be used in different ways, some sort of a sim, etc.. Interaction is, in my opinion, the most important part of a game.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: point&click events

Post by kikito »

Since you are asking for advice, I will comment on the implementation of events.

A good way to do that is making your game objects able to emit and observes signals.

A signal can be nearly anything, for example a string. "Emitting" can be simply calling a function that stores the signal on a private table. And observing is calling another function that says "when this signal appears on the table of signals, call this function". On each update cycle, the table of signals is parsed, the functions inside the table of functions are invoked accordingly, and then the signals are erased.

Here's an example of this pattern for an hypothetical "pause button".

Code: Select all

observe_signal("PAUSE", function() pause_enemy(enemy1) end)
observe_signal("PAUSE", function() pause_enemy(enemy2) end)
observe_signal("PAUSE", function() pause_player(player) end) 
...
function pause_button_pressed()
  emit_signal("PAUSE")
end
I implemented such a system with Beholder, but I have to re-do now that I've updated middleclass. I'll probably separate it from it to make it a bit more lightweight.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests