Search found 28 matches
- Wed May 01, 2019 9:40 am
- Forum: Support and Development
- Topic: Using for loop in my code [SOLVED]
- Replies: 1
- Views: 781
Using for loop in my code [SOLVED]
I couldn't find a good title, sorry. I need to use for in my code. So I can do my job with less code. local touches = love.touch.getTouches() for i, id in ipairs(touches) do local x, y = love.touch.getPosition(id) if x < w / 2 then -- if player 1 touched her area if x > 200 then -- if player 1 touch...
- Mon Apr 29, 2019 6:25 am
- Forum: Support and Development
- Topic: question about local and global [SOLVED]
- Replies: 6
- Views: 1931
Re: question about local and global
So x in the first code is global right?
- Mon Apr 29, 2019 4:26 am
- Forum: Support and Development
- Topic: question about local and global [SOLVED]
- Replies: 6
- Views: 1931
question about local and global [SOLVED]
Whats the difference between the codes above?
In the second code, x is local. But in the first code, is it global or local? I think both codes is the same.
Code: Select all
function love.load()
x = 10
end
Code: Select all
local x
function love.load()
x = 10
end
- Sun Apr 28, 2019 6:25 pm
- Forum: Games and Creations
- Topic: A simple two player game
- Replies: 1
- Views: 2221
A simple two player game
There are two elements in the game. Fire and water. Test it on a phone. It seems bad on PC. I am thinking how can i make the code lesser.
- Sat Apr 27, 2019 2:07 pm
- Forum: Support and Development
- Topic: Collision problem in my code [SOLVED]
- Replies: 5
- Views: 3454
Re: Collision problem in my code
im so sorry. how can i remove my thread
- Sat Apr 27, 2019 6:39 am
- Forum: Support and Development
- Topic: Help about my code [SOLVED]
- Replies: 3
- Views: 1247
Re: Help about my code
I solved the errors. local w local h local p = {} p[1] = {} p[2] = {} p[1].slot = {} p[1].slot[1] = {} p[1].slot[2] = {} p[1].slot[3] = {} p[1].slot[4] = {} p[2].slot = {} p[2].slot[1] = {} p[2].slot[2] = {} p[2].slot[3] = {} p[2].slot[4] = {} local spell = {} spell[1] = {} spell[2] = {} spell[3] = ...
- Fri Apr 26, 2019 6:54 pm
- Forum: Support and Development
- Topic: Help about my code [SOLVED]
- Replies: 3
- Views: 1247
Help about my code [SOLVED]
I couldn't figure out. :( what is the error? local w local h local p = {} p[1] = {} p[2] = {} p[1].slot = {} p[1].slot[1] = {} p[1].slot[2] = {} p[1].slot[3] = {} p[1].slot[4] = {} p[2].slot = {} p[2].slot[1] = {} p[2].slot[2] = {} p[2].slot[3] = {} p[2].slot[4] = {} local spell = {} spell[1] = {} s...
- Wed Apr 24, 2019 5:11 pm
- Forum: Support and Development
- Topic: Collision detection between bullets [SOLVED]
- Replies: 5
- Views: 3302
Re: Collision detection between bullets
Thanks raidho36. It works now but SOMETIMES one bullet is not be destroyed after collision of two bullets. I want both to be destroyed. for i, v in ipairs(projectiles) do v.x = v.x + v.speed * dt for ii = 1, 2 do if CheckCollision(v.x, v.y, v.w, v.h, p[ii].x, p[ii].y, p[ii].w, p[ii].h) then if ii ==...
- Tue Apr 23, 2019 6:14 pm
- Forum: Support and Development
- Topic: Collision detection between bullets [SOLVED]
- Replies: 5
- Views: 3302
Collision detection between bullets [SOLVED]
I have this code how can I check collision between two v's.
Code: Select all
for i, v in ipairs(listOfBullets) do v:update(dt) end
- Tue Apr 23, 2019 3:02 pm
- Forum: Support and Development
- Topic: Collision problem in my code [SOLVED]
- Replies: 5
- Views: 3454
Collision problem in my code [SOLVED]
What is the problem? It is not accurate. local w local h local p = {} p[1] = {} p[2] = {} p[1].touch = {} p[2].touch = {} local iceSpikeSlot local airSwipeSlot local projectiles = {} local iceSpike local airSwipe function love.load() w, h = love.graphics.getDimensions() p[1].x = w / 4 p[2].x = 3 * w...