Whats the Easiest Game ?

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.
Pigzo
Prole
Posts: 17
Joined: Mon Apr 09, 2012 8:49 pm

Re: Whats the Easiest Game ?

Post by Pigzo »

I Can Read this Code

Code: Select all

function CheckCollision(x1, y1, w1, h1, x2, y2, w2, h2)
   if x1 > (x2 + w2) or (x1 + w1) < x2 then return false end
   if y1 > (y2 + h2) or (y1 + h1) < y2 then return false end
   return true
end
but dunno where are the rectangles? xD
User avatar
baconhawka7x
Party member
Posts: 494
Joined: Mon Nov 21, 2011 7:05 am
Location: Oregon, USA
Contact:

Re: Whats the Easiest Game ?

Post by baconhawka7x »

The first game I made was a top-down(I thinks that's how you say it) shooter. Where you were just a box, and you would run around and shoot other boxes. I thought it was a good start.
It taught me BASIC collision:) How to make an efficiant menu. BASIC AI. Controls. Movement. And camera Movement. And of course there are probably a million other things that I forgot to mention. Overall it's a good way to start. And of course you could always do what I didn't do. And add continue development with it and learn EVEN MORE!;D
But It's a pretty simple way to start out, and to teach you the basics. As for the pong idea, I like it. And it could teach you alot!
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Whats the Easiest Game ?

Post by veethree »

Pigzo wrote:I Can Read this Code

Code: Select all

function CheckCollision(x1, y1, w1, h1, x2, y2, w2, h2)
   if x1 > (x2 + w2) or (x1 + w1) < x2 then return false end
   if y1 > (y2 + h2) or (y1 + h1) < y2 then return false end
   return true
end
but dunno where are the rectangles? xD
The function detects the rectangle collision, it doesn't make them. Check the .love i attached, It shows how to use the function. I added some comments to clarify the code.
Pigzo
Prole
Posts: 17
Joined: Mon Apr 09, 2012 8:49 pm

Re: Whats the Easiest Game ?

Post by Pigzo »

Does it check automatically?
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Whats the Easiest Game ?

Post by veethree »

Pigzo wrote:Does it check automatically?
This can't be that hard to understand. The function takes 8 parameters.

Code: Select all

function CheckCollision([b]x1, y1, w1, h1, x2, y2, w2, h2[/b])
	if x1 > (x2 + w2) or (x1 + w1) < x2 then return false end
	if y1 > (y2 + h2) or (y1 + h1) < y2 then return false end
	return true
end


First 4 would be the x position, y position, width and height(in that order) of the first rectangle, The last 4 would be the same but for the rectangle the first one should collide with. If you just stick the code i gave you somewhere in your file, It's not gonna do anything. You need to call it somewhere. Collision is usually handled in love.update() or love.draw(). If you look at the example in my last comment, You'll see that under love.draw i call the function and give it the parameters of the rectangles which i define in love.load(). Then the function figures out if the rectangles are colliding or not, If they are it returns true, otherwise it returns false. And in love.draw() you can see that i set it up so if the function returns true it will set the color to red, Otherwise it sets it to white.

If this doesn't help, Then i'm sorry but i don't believe i can explain it any clearer.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Whats the Easiest Game ?

Post by TechnoCat »

User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Whats the Easiest Game ?

Post by miko »

Pigzo wrote:Whats the Easiest Game i can made? :huh:
Try this: viewtopic.php?f=5&t=3605
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Whats the Easiest Game ?

Post by pekka »

Well, one more late reply to the original question. He is my two cents. We can say that now here too because of Euros (and cents).

I find the easiest non-trivial games to write quickly are the ones that work on a grid. Almost all you have to understand to write them is how to address two dimensional arrays, or in a pinch how to simulate a 2d array on a single Lua table. Collision detection is just checking if there are two or more objects in the same location.

You can write a simple snake game like this. It's also possible to write a block game where you have to match three colors or items in a row to make the disappear and have more room for new blocks. It's easier than Tetris, because Tetris has those piece rotations which are a little bit hard to get right.

You can also write turn-based games like Robots, which is also sometimes known as Daleks and a bunch of other names. Wikipedia talks about one version here:

http://en.wikipedia.org/wiki/Robots_%28BSD_game%29

If you can do simple mouse hit-testing, some games where you have to quickly click on moving objects or walk the mouse pointer through some narrow paths are also quite easy to make. I don't know if any of these games even have names, but I've seen some practice Flash games people've made like this.

But learning how to work with 2d coordinates is pretty much a key skill in writing games, at least until you add the 3rd dimenions. And it's easier with a grid, so making some games on a 2D grid is probably a nice way to start writing games. Even the very exciting proto-game of a guy just walking around is a good thing to make for practice. In the sequel he will bump against walls and not move!

Also, don't be afraid to ask for questions and suggestions. You don't have to learn programming all on your own, you know.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Whats the Easiest Game ?

Post by josefnpat »

Oh, here was one of my first games that I made in middle school for the TI83p (Should work on the TI8[3|4](p) )

http://www.ticalc.org/archives/files/fi ... 25215.html

Image

Image
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests