Search found 15 matches
- Mon Sep 03, 2012 8:44 pm
- Forum: Support and Development
- Topic: Multiple Enemies
- Replies: 13
- Views: 6062
Re: Multiple Enemies
But what's up with the code I posted a minute ago :/
- Mon Sep 03, 2012 8:00 pm
- Forum: Support and Development
- Topic: Multiple Enemies
- Replies: 13
- Views: 6062
Re: Multiple Enemies
Ok thanks for all the help! I tried using this code... main.lua ---------- require "entities" function love.draw() end function love.draw() end function love.update(dt) end entities.lua -------- player = { x=15, y=25 } function player:draw() love.graphics.setColor(0, 255, 0) love.graphics....
- Fri Aug 24, 2012 10:48 pm
- Forum: Support and Development
- Topic: Multiple Enemies
- Replies: 13
- Views: 6062
Re: Multiple Enemies
Thanks, that is really useful
Could someone explain to me please what the significance of having a table such as player = {} and then creating function called player:draw() rather than calling it playerDraw().
Thanks!
Could someone explain to me please what the significance of having a table such as player = {} and then creating function called player:draw() rather than calling it playerDraw().
Thanks!
- Fri Aug 24, 2012 9:51 pm
- Forum: Support and Development
- Topic: Multiple Enemies
- Replies: 13
- Views: 6062
Multiple Enemies
Hi, I have been trying to get it to work so it create multiple instances of an enemy at different positions and this is what I have. It doesn't do anything but it doesn't bring back any errors. function love.load() enemyNumber = 0 enemies = {} end function love.draw() for i,v in ipairs(enemies) do l...
- Sun Aug 19, 2012 12:27 pm
- Forum: Support and Development
- Topic: Inserting into tables
- Replies: 21
- Views: 8271
Re: Inserting into tables
At the moment I just want to be able to place unlimited amounts of balls by left clicking. That will then lead be on to be able to understand how to create enemies and other things which there are multiple of.
- Sun Aug 19, 2012 1:38 am
- Forum: Support and Development
- Topic: Inserting into tables
- Replies: 21
- Views: 8271
Re: Inserting into tables
Thanks for that :) So is this the idea? ball = {} ball.balls = {} ball.x = 0 ball.y = 0 ball.alive = false function ball.load() ball.image = love.graphics.newImage("images/ball.png") end function ball.draw() for i,v in ipairs(ball.balls) do if ball.alive then table.insert(ball.balls[i]{x =...
- Sun Aug 19, 2012 12:38 am
- Forum: Support and Development
- Topic: Inserting into tables
- Replies: 21
- Views: 8271
Re: Inserting into tables
Ok, so after reading through the resources you kindly suggested I understand the concepts better. I am now able to place the ball at my mouse cursor and keep it there until the next time I click, but I haven't got it down how multiple objects works, so if anyone could help with that that would be gr...
- Sat Aug 18, 2012 7:12 pm
- Forum: Support and Development
- Topic: Inserting into tables
- Replies: 21
- Views: 8271
Re: Inserting into tables
Oh and, how do I make multiple instances of said ball? All it does at the moment is appear and follow the mouse, I want it to appear and stay at the x and y position and allow me to create more balls.
- Sat Aug 18, 2012 7:10 pm
- Forum: Support and Development
- Topic: Inserting into tables
- Replies: 21
- Views: 8271
Re: Inserting into tables
One other thing, I compressed my folder into a zip on Mac and then changed the extension to .love and it told me there was no code.
- Sat Aug 18, 2012 6:53 pm
- Forum: Support and Development
- Topic: Inserting into tables
- Replies: 21
- Views: 8271
Re: Inserting into tables
Yes, here is the main.lua require "player" require "world" require "objects" function love.load() player.load() world.load() objects.load() end function love.draw() player.draw() objects.draw() end function love.update(dt) player.update(dt) objects.update() end