UBO a minimalist Qix Clone

Show off your games, demos and other (playable) creations.
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

UBO a minimalist Qix Clone

Post by chezrom »

Hi,

Here is my first Löve game : a minimalist qix clone that I call "UBO" (Unknown Bouncing Object).
It is in fact a clone of 'miniqix' a javascript game posted for the 2013 ludum dare.

I must do some evolutions in future but the game is playable (some work with collision, prettier display ...).
My purpose is a clear code, so I use middleclass and stateless. I hope the code is easily understable.

I also post the source on git (https://github.com/chezrom/ubo).

Usage : the arrow keys. You must claim 75 % of the area to go to next level. When building wall, you are vulnerable.
Attachments
ubo.love
faster movement - menus - 'safe' movements
(13.06 KiB) Downloaded 198 times
Last edited by chezrom on Tue Jun 04, 2013 11:04 pm, edited 2 times in total.
User avatar
easy82
Party member
Posts: 184
Joined: Thu Apr 18, 2013 10:46 pm
Location: Hungary

Re: UBO a minimalist Qix Clone

Post by easy82 »

Good job, I've tried it out! However, the arrow is waaay too slow! Make it faster so that I can pass the first level. :) Also, the enemy did not really touch the line but it was game over nevertheless. Nice, clean code, by the way! I don't understand why you need this grid thing, and why not use function to check line (ray) vs rectangle intead.
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

Re: UBO a minimalist Qix Clone

Post by chezrom »

Thank for your comment Easy82.

For the speed, I think some calibration is needed.
But all the game interest is in the fact that the enemies are faster than you, you must claim little rectangles by little rectangles and in fact build a "tree", and after you can claim big area by drawing short line.
easy82 wrote:Also, the enemy did not really touch the line but it was game over nevertheless.
I don't understand the bug. Maybe I forget to say that you must not hit your building wall too ?
I don't understand why you need this grid thing, and why not use function to check line (ray) vs rectangle intead.
I think using grid is easier (I can be wrong), and in fact I take less than a half day to code this (And another half day to refactor the code to be object oriented :3 )
User avatar
Darky
Citizen
Posts: 66
Joined: Sat Jun 02, 2012 1:41 pm
Contact:

Re: UBO a minimalist Qix Clone

Post by Darky »

I agree with easy82, it's wayy tooo slow.. even if the enemy must be faster than you, being that slow will annoy every player. (I'm basically waiting between orders).
Also, no grid make the player happy :D
http://darky-ben.fr/Xut my webcomic (french)
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

Re: UBO a minimalist Qix Clone

Post by chezrom »

After some try, I found that effectively a faster move is better.
I modify the file (next step : to set this speed in the game)
User avatar
easy82
Party member
Posts: 184
Joined: Thu Apr 18, 2013 10:46 pm
Location: Hungary

Re: UBO a minimalist Qix Clone

Post by easy82 »

chezrom wrote:
easy82 wrote:Also, the enemy did not really touch the line but it was game over nevertheless.
I don't understand the bug. Maybe I forget to say that you must not hit your building wall too ?
I mean I could almost finish fencing off my area when it was Game Over, but I could clearly see that the lines and the enemy did not intersect! Maybe it is a grid-related issue.
chezrom wrote:
easy82 wrote:I don't understand why you need this grid thing, and why not use function to check line (ray) vs rectangle intead.
I think using grid is easier (I can be wrong), and in fact I take less than a half day to code this (And another half day to refactor the code to be object oriented :3 )
Here's some code for you. By using it you can detect if the path of the enemy crosses any of the lines.

Code: Select all

-- Original code is at http://flassari.is/2008/11/line-line-intersection-in-cplusplus/
-- /return true if the given rays intersects, and also returns the x and y coordinates of the intersection
-- /param x1, y1: start point of ray #1
-- /param x2, y2: end point of ray #1
-- /param x3, y3: start point of ray #2
-- /param x4, y4: end point of ray #2
function isectRay2Ray(x1, y1, x2, y2, x3, y3, x4, y4)
  -- If d is zero, there is no intersection
  local d = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)
  if d == 0 then return false end
 
  -- Get the x and y
  local pre  = x1 * y2 - y1 * x2
  local post = x3 * y4 - y3 * x4
  local x = (pre * (x3 - x4) - (x1 - x2) * post) / d
  local y = (pre * (y3 - y4) - (y1 - y2) * post) / d
 
  -- Check if the x and y coordinates are within both lines
  local epsilon = 0.00001

  if x < math.min(x1, x2) - epsilon or x > math.max(x1, x2) + epsilon or
     x < math.min(x3, x4) - epsilon or x > math.max(x3, x4) + epsilon then
    return false
  end
  if y < math.min(y1, y2) - epsilon or y > math.max(y1, y2) + epsilon or
     y < math.min(y3, y4) - epsilon or y > math.max(y3, y4) + epsilon then
    return false
  end
 
  -- Return the point of intersection
  return true, x, y
end
You could use it like this, for example:

Code: Select all

for _, v in pairs(lines) do
  local isect, x, y = isectRay2Ray(enemy.oldX, enemy.oldY, enemy.posX, enemy.posY, v.startX, v.startY, v.endX, v.endY)
  if isect == true then
    -- Handle collision the way you want it ...
  end
end
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: UBO a minimalist Qix Clone

Post by qaisjp »

im saw i played this game when i was 6 or something, and i remember clearly that the smallest of the two halves would be filled up... and if you did this with one of these birds in it the birds would die. why doesn't it happen here :(
Lua is not an acronym.
User avatar
chezrom
Citizen
Posts: 59
Joined: Tue May 28, 2013 11:03 pm
Location: France

Re: UBO a minimalist Qix Clone

Post by chezrom »

qaisjp wrote:im saw i played this game when i was 6 or something, and i remember clearly that the smallest of the two halves would be filled up... and if you did this with one of these birds in it the birds would die. why doesn't it happen here :(
In fact Qix, as Space Invaders, Pacman, ... was a successfull game and then many clones exist with many different behaviour, or new features.
I have already seen the version you speak about , but other clones have not this behaviour.

I think is more challenging to claim 3/4 of the area without killing enemies.
User avatar
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

Re: UBO a minimalist Qix Clone

Post by buhb11 »

Awesome game! I enjoy it a lote
I found Love very enjoyable and nice!
User avatar
SneakySnake
Citizen
Posts: 94
Joined: Fri May 31, 2013 2:01 pm
Contact:

Re: UBO a minimalist Qix Clone

Post by SneakySnake »

Fun game, there is one thing that annoys me a bit:
Sometimes, you can accidentally press the key opposite to the direction you are going in (for example when turning back), causing you to crash into your trail.
I think the game should just ignore the key if it's opposite to the direction you are going in, because this move has no other purpose than being an "instant game over" move.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests