Need tips about block breaker 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.
Post Reply
User avatar
srcn
Citizen
Posts: 59
Joined: Fri Dec 28, 2012 2:22 am
Location: Tartu
Contact:

Need tips about block breaker game

Post by srcn »

Been long time not using löve and now wanna stretch myself writing a small block breaker game. What tips you'd give me to create the game structure.
I am a mad scientist!
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Need tips about block breaker game

Post by micha »

My tip is: Do it step by step and don't overthink it.
With step by step I mean, just start implementing some blocks or a paddle and the basic movement, then add a ball, get it right and so on. The structure of your game grows together with the features that are already implemented.
With "don't overthink" I mean that you should just start the project. Of course it is a good thing to do things cleverly, but on the other hand, don't wait until you have figured out the perfect engine in your mind.
User avatar
srcn
Citizen
Posts: 59
Joined: Fri Dec 28, 2012 2:22 am
Location: Tartu
Contact:

Re: Need tips about block breaker game

Post by srcn »

I will have to deal with creating a grid that holds blocks, gotta use a matrix for that I guess. That would help me create different maps as well.
I am a mad scientist!
User avatar
srcn
Citizen
Posts: 59
Joined: Fri Dec 28, 2012 2:22 am
Location: Tartu
Contact:

Re: Need tips about block breaker game

Post by srcn »

tried to create the grid which holds images named cell but getting attempt to index field '?' (a nil value) error

Code: Select all

for i = 1, 15 do
	for j = 1, 10 do
		grid[i][j] = {cell}
	end
end
I am a mad scientist!
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Need tips about block breaker game

Post by micha »

First you have to create grid and grid

Code: Select all

grid = {}
for i = 1, 15 do
   grid[i] = {}
   for j = 1, 10 do
      grid[i][j] = {cell}
   end
end
User avatar
srcn
Citizen
Posts: 59
Joined: Fri Dec 28, 2012 2:22 am
Location: Tartu
Contact:

Re: Need tips about block breaker game

Post by srcn »

thanx that helped! and do i destroy an objetc from matrix? making it nil is not working. should i use table instead of matrix?
I am a mad scientist!
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Need tips about block breaker game

Post by micha »

srcn wrote:and do i destroy an objetc from matrix? making it nil is not working. should i use table instead of matrix?
What exactly is not working? If you set one entry to nil, it should be deleted. But keep in mind that the matrix is a table of tables (a table of columns). So if you remove one entry, the matrix still has the same number of columns and rows. Only one entry is gone. Even if you remove all entries in one column, the column will not disappear, but you end up with an empty table in one column.

You could also store a 0 in every entry that does not have a block and a different number, if there is a block. That would take slightly more memory, but the difference is so small that you should not worry about it.
User avatar
srcn
Citizen
Posts: 59
Joined: Fri Dec 28, 2012 2:22 am
Location: Tartu
Contact:

Re: Need tips about block breaker game

Post by srcn »

Sorry my fault, trying to draw a nil matrix cell was the problem. Thanks again.
I am a mad scientist!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 190 guests