Spawning an object

General discussion about LÖVE, Lua, game development, puns, and unicorns.
CalebAnder
Prole
Posts: 16
Joined: Fri Jan 15, 2016 6:33 pm

Re: Spawning an object

Post by CalebAnder »

But the problem is the plane moves. Is there a way the x and y coordinates for the bomb to spawn follow the plane?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Spawning an object

Post by zorg »

First, please delete 3 of your 4 posts. (and next time, make sure to see whether your post went on the next page or not ;) )
Second, using a table for the plane's data like for the bombs, you can get the plane's x and y position in the bomb spawning function; so you'll always spawn the bombs where the plane is, even if you moved it.
Edit: apparently i managed to misread the question, sorry about that; look at S0lll0s' answer instead.
Last edited by zorg on Sat Jan 16, 2016 5:01 pm, edited 2 times in total.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
CalebAnder
Prole
Posts: 16
Joined: Fri Jan 15, 2016 6:33 pm

Re: Spawning an object

Post by CalebAnder »

Yeah sorry about that. I was a bit confused :P thank you so much for the help. I will try this later and tell you if it works. I really appreciate your help :awesome:
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Spawning an object

Post by s-ol »

or you just update the bombs with their own speed, you set the x-velocity (speed) when you spawn them and add it to the x coordinate every frame. Otherwise if you fly zig-zag the bombs will do that too, which will be pretty weird.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests