Which button was pressed?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
dubem
Prole
Posts: 8
Joined: Fri Mar 27, 2015 1:42 pm

Which button was pressed?

Post by dubem »

Hey gang!

I'm making a one button minigame for my colleagues.

At the beginning of the game, every player should be able to press a button of her choice. This button then becomes the "action" button for this player for the rest of the game.

How can I do this?

Löve and kisses

Alex
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Which button was pressed?

Post by s-ol »


s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
dubem
Prole
Posts: 8
Joined: Fri Mar 27, 2015 1:42 pm

Re: Which button was pressed?

Post by dubem »

Sorry, but i don't get it. How do I use keypressed to assign a key to the player after pressing?
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Which button was pressed?

Post by s-ol »

dubem wrote:Sorry, but i don't get it. How do I use keypressed to assign a key to the player after pressing?
You detect the key that is pressed and store it in a variable, then use that variable as a reference later to find the player who pressed it.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest