HelloColor

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
TylertheDesigner
Citizen
Posts: 80
Joined: Sat Apr 10, 2010 2:27 am

HelloColor

Post by TylertheDesigner »

Hello Color started as a tutorial for a friend, teaching him Lua + LOVE. However, after the tutorial session, I began tweaking the code, and came up with this simple prototype. The goal of the game is to find the circle matching the background color. The game ends when you have cleared all the circles. The total circles is based on the starting game resolution.

Enjoy!
Attachments
HelloColor.love
(25.89 KiB) Downloaded 136 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: HelloColor

Post by Robin »

It's pretty late at night, so I don't have much time to try it out, but I have one piece of criticism that applies to your other games posted as well: please use love.keypressed rather than love.keyboard.isDown, because it is rather annoying when I tap a key once and it treats it like > 1.
Help us help you: attach a .love.
User avatar
crow
Party member
Posts: 186
Joined: Thu Feb 24, 2011 11:47 pm
Location: UK
Contact:

Re: HelloColor

Post by crow »

Robin wrote:It's pretty late at night, so I don't have much time to try it out, but I have one piece of criticism that applies to your other games posted as well: please use love.keypressed rather than love.keyboard.isDown, because it is rather annoying when I tap a key once and it treats it like > 1.
I second that change in all of your games so far it is rather annoying.
Sir Kittenface
Möko IDE Codename (Erös) Returns Soon

I am dyslexic so if any of my replys confusing please just ask me to reword it as this will make things a lot easier for all parties lol.
User avatar
TylertheDesigner
Citizen
Posts: 80
Joined: Sat Apr 10, 2010 2:27 am

Re: HelloColor

Post by TylertheDesigner »

Robin wrote:It's pretty late at night, so I don't have much time to try it out, but I have one piece of criticism that applies to your other games posted as well: please use love.keypressed rather than love.keyboard.isDown, because it is rather annoying when I tap a key once and it treats it like > 1.
The problem I have with that (and I hope you guys can offer solutions) is that when its love.keypressed and you already have another key held, it stops detecting that key. In some of the games I have made, I set separate booleans for the keys (Player1.upKeyIsDown, etc).

Is there another way I can resolve this issue?

Thanks for the feedback!
User avatar
crow
Party member
Posts: 186
Joined: Thu Feb 24, 2011 11:47 pm
Location: UK
Contact:

Re: HelloColor

Post by crow »

TylertheDesigner wrote:
Robin wrote:It's pretty late at night, so I don't have much time to try it out, but I have one piece of criticism that applies to your other games posted as well: please use love.keypressed rather than love.keyboard.isDown, because it is rather annoying when I tap a key once and it treats it like > 1.
The problem I have with that (and I hope you guys can offer solutions) is that when its love.keypressed and you already have another key held, it stops detecting that key. In some of the games I have made, I set separate booleans for the keys (Player1.upKeyIsDown, etc).

Is there another way I can resolve this issue?

Thanks for the feedback!
to a maybe do a double check like

Code: Select all

if Player1.upKeyIsDown and Player1.upKeyIsDown then
maybe not sure if love would let you do this?
Sir Kittenface
Möko IDE Codename (Erös) Returns Soon

I am dyslexic so if any of my replys confusing please just ask me to reword it as this will make things a lot easier for all parties lol.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: HelloColor

Post by tentus »

crow wrote:
TylertheDesigner wrote:
Robin wrote:It's pretty late at night, so I don't have much time to try it out, but I have one piece of criticism that applies to your other games posted as well: please use love.keypressed rather than love.keyboard.isDown, because it is rather annoying when I tap a key once and it treats it like > 1.
The problem I have with that (and I hope you guys can offer solutions) is that when its love.keypressed and you already have another key held, it stops detecting that key. In some of the games I have made, I set separate booleans for the keys (Player1.upKeyIsDown, etc).

Is there another way I can resolve this issue?

Thanks for the feedback!
to a maybe do a double check like

Code: Select all

if Player1.upKeyIsDown and Player1.upKeyIsDown then
maybe not sure if love would let you do this?
That would work, yeah. This is what I currently use for the player in my game, Kurosuke:

Code: Select all

	local left = love.keyboard.isDown(self.key.left) or joystick.pressed[self.key.left]
	local right = love.keyboard.isDown(self.key.right) or joystick.pressed[self.key.right]
	if right and not left then
		ent.actor.avatar[self.id].direction = 1
		ent.actor.avatar[self.id]:run()
	elseif left and not right then
		ent.actor.avatar[self.id].direction = -1
		ent.actor.avatar[self.id]:run()
	end
There's some extra code in there that you wouldn't need (such as my joystick code), but you get the idea.
Kurosuke needs beta testers
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: HelloColor

Post by thelinx »

I personally solve that problem by using vectors.

It looks something like this:

Code: Select all

moveBy = Vector(0, 0)
if isDown("right") then
  moveBy = moveBy + Vector(1, 0)
end
if isDown("down") then
  moveBy = moveBy + Vector(0, 1)
end
if isDown("left") then
  moveBy = moveBy - Vector(1, 0)
end
if isDown("up") then
  moveBy = moveBy - Vector(0, 1)
end
player:move(moveBy * player.speed * dt)
This also makes it super easy to implement joystick input. Just replace all those if statements with:

Code: Select all

moveBy = Vector(love.joystick.getAxis(0), love.joystick.getAxis(1)) -- or something similar
User avatar
crow
Party member
Posts: 186
Joined: Thu Feb 24, 2011 11:47 pm
Location: UK
Contact:

Re: HelloColor

Post by crow »

Is vectors a love function ? or a lua module?
Sir Kittenface
Möko IDE Codename (Erös) Returns Soon

I am dyslexic so if any of my replys confusing please just ask me to reword it as this will make things a lot easier for all parties lol.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: HelloColor

Post by thelinx »

There are several implementations, I can recommend the Vector "class" in vrld's HUMP library.
Post Reply

Who is online

Users browsing this forum: No registered users and 64 guests