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.
UBO a minimalist Qix Clone
Re: UBO a minimalist Qix Clone
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.
Re: UBO a minimalist Qix Clone
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.
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.
I don't understand the bug. Maybe I forget to say that you must not hit your building wall too ?easy82 wrote:Also, the enemy did not really touch the line but it was game over nevertheless.
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 )I don't understand why you need this grid thing, and why not use function to check line (ray) vs rectangle intead.
Re: UBO a minimalist Qix Clone
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
Also, no grid make the player happy
http://darky-ben.fr/Xut my webcomic (french)
Re: UBO a minimalist Qix Clone
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)
I modify the file (next step : to set this speed in the game)
Re: UBO a minimalist Qix Clone
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:I don't understand the bug. Maybe I forget to say that you must not hit your building wall too ?easy82 wrote:Also, the enemy did not really touch the line but it was game over nevertheless.
Here's some code for you. By using it you can detect if the path of the enemy crosses any of the lines.chezrom wrote: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 )easy82 wrote:I don't understand why you need this grid thing, and why not use function to check line (ray) vs rectangle intead.
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
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
Re: UBO a minimalist Qix Clone
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.
Re: UBO a minimalist Qix Clone
In fact Qix, as Space Invaders, Pacman, ... was a successfull game and then many clones exist with many different behaviour, or new features.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
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.
Re: UBO a minimalist Qix Clone
Awesome game! I enjoy it a lote
I found Love very enjoyable and nice!
- SneakySnake
- Citizen
- Posts: 94
- Joined: Fri May 31, 2013 2:01 pm
- Contact:
Re: UBO a minimalist Qix Clone
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.
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.
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests