Help spawning objects?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Amatereasu
Prole
Posts: 7
Joined: Wed May 10, 2023 6:30 am

Help spawning objects?

Post by Amatereasu »

hello! ^^ i started learning Lua and Love a few days ago, and ive been working on a rhythm game project that i've always wanted to make
anyway.
ive looked around for this and it all seems pretty complicated and shit just goes over my head when theres so many words in front of me XD and i have to try to apply other peoples specific experiences to mine

could i get a breakdown on how to spawn an object using a table? i want a note to spawn on the far right and arrive at the strum line in a certain amount of seconds (im pretty sure i know how to do that but if anyone would like to help i would be very grateful :cry:)
thank you in advance :3

so far what it looks like :P
https://cdn.discordapp.com/attachments/ ... -51-26.mp4
User avatar
darkfrei
Party member
Posts: 1185
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help spawning objects?

Post by darkfrei »

Code: Select all

objects= {}

function newObject (x, y, vx, vy)
  local obj = {x=x, y=y, vx=vx, vy=vy}
  return obj
end

table.insert (objects, newObject (1,2,3,4))
table.insert (objects, newObject (2,3,4,5))
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
Amatereasu
Prole
Posts: 7
Joined: Wed May 10, 2023 6:30 am

Re: Help spawning objects?

Post by Amatereasu »

darkfrei wrote: Wed May 10, 2023 2:25 pm

Code: Select all

objects= {}

function newObject (x, y, vx, vy)
  local obj = {x=x, y=y, vx=vx, vy=vy}
  return obj
end

table.insert (objects, newObject (1,2,3,4))
table.insert (objects, newObject (2,3,4,5))
lotsa words, thank you! ill try this when i get home to my PC
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest