hola estoy tratando de crear un juego de tanques, pero ala hora de crear el efecto de los cañones cayendo, no se como hacerlo.
asi que e venido con la siguiente pregunta:
¿alguien podria decirme o orientarme sobre el tema?
!para poder hacer que al lanzar un cañon este haga el efecto de que esta callendo
please help
Re: please help
Ermm...
Your cannon barrel should be a separate image, obviously. You will also need a variable to remember recoil length and optionally another for recoil speed. When cannon is fired, you set your recoil speed to some negative value, and every update you 1) increase your recoil length by recoil speed and 2) increase recoil speed by some number. Then, when you draw your cannon, to it's X and Y coordinates you add recoil * cos ( angle ) and recoil * -sin ( angle ) respectively.
Okay... I assume you want cannon recoil effect.hello I'm trying to create a set of tanks, but wing when creating the effect of falling cannons, not how.
so and come with the following question:
Could anyone tell me or guide me on the subject?
! to be able to do that by throwing a barrel this makes the effect of which is falling
Your cannon barrel should be a separate image, obviously. You will also need a variable to remember recoil length and optionally another for recoil speed. When cannon is fired, you set your recoil speed to some negative value, and every update you 1) increase your recoil length by recoil speed and 2) increase recoil speed by some number. Then, when you draw your cannon, to it's X and Y coordinates you add recoil * cos ( angle ) and recoil * -sin ( angle ) respectively.
Code: Select all
local recoil_amp, recoil_spd = 0, 0
love.update ( dt )
-- blah blah blah
if shoot == 1 then
recoil_spd = -10 --this affects how big recoil is
end
recoil_amp = recoil_amp + recoil_spd
recoil_spd += dt * 0.1 -- this affects how fast recoil stops
if recoil_amp >= 0 then -- this stops recoil
recoil_amp = 0
recoil_spd = 0
end
love.draw ( )
love.graphics.draw ( cannon, cannon_x + recoil_amp * math.sin ( cannon_angle ), cannon_y + recoil_amp * -math.cos ( cannon_angle ), cannon_angle )
- luislasonbra
- Citizen
- Posts: 60
- Joined: Sun Jun 24, 2012 1:57 pm
Re: please help
raidho36 wrote:Ermm...Okay... I assume you want cannon recoil effect.hello I'm trying to create a set of tanks, but wing when creating the effect of falling cannons, not how.
so and come with the following question:
Could anyone tell me or guide me on the subject?
! to be able to do that by throwing a barrel this makes the effect of which is falling
Your cannon barrel should be a separate image, obviously. You will also need a variable to remember recoil length and optionally another for recoil speed. When cannon is fired, you set your recoil speed to some negative value, and every update you 1) increase your recoil length by recoil speed and 2) increase recoil speed by some number. Then, when you draw your cannon, to it's X and Y coordinates you add recoil * cos ( angle ) and recoil * -sin ( angle ) respectively.Code: Select all
local recoil_amp, recoil_spd = 0, 0 love.update ( dt ) -- blah blah blah if shoot == 1 then recoil_spd = -10 --this affects how big recoil is end recoil_amp = recoil_amp + recoil_spd recoil_spd += dt * 0.1 -- this affects how fast recoil stops if recoil_amp >= 0 then -- this stops recoil recoil_amp = 0 recoil_spd = 0 end love.draw ( ) love.graphics.draw ( cannon, cannon_x + recoil_amp * math.sin ( cannon_angle ), cannon_y + recoil_amp * -math.cos ( cannon_angle ), cannon_angle )
gracias esto me funciono de 100%
pero el tipo de juego, que estoy haciendo
es mas o menos parecido a angry birds en la forma de lansar las aves
ejemplo:
si disparo una flecha esta logicamente ira callendo segun balla abansando.
este es el efecto que quiero hacer para los disparos del tanke.
edito:
loque quiero hacer es algo como esto
http://www.mathsisfun.com/games/tanks.html
Re: please help
You welcome.
So you're making Angry Birds Scorched Earth? Sounds like fun.
So you're making Angry Birds Scorched Earth? Sounds like fun.
- luislasonbra
- Citizen
- Posts: 60
- Joined: Sun Jun 24, 2012 1:57 pm
Re: please help
no no quiero hacer un angry birdsraidho36 wrote:You welcome.
So you're making Angry Birds Scorched Earth? Sounds like fun.
solo quiero hacer que cuando dispare un cañon este caiga progresivamente
- NightKawata
- Party member
- Posts: 294
- Joined: Tue Jan 01, 2013 9:18 pm
- Location: Cyberspace, Room 6502
- Contact:
Re: please help
luislasonbra wrote: no no quiero hacer un angry birds
solo quiero hacer que cuando dispare un cañon este caiga progresivamente
Also, can you please either translate your posts, or stop speaking in spanish, please?my attempted translation wrote: no no I don't want to make an angry birds
I want to make it when (you) shoot a cannon it'll (?) fall progressively
(se puede utilizar la traduccion de tu palabras, o no hables en la español, por favor?) (again, another crappy translation done by me)
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: please help
luislasonbra, it might be useful to check out Duolingo, you can learn English there and knowing English is a really useful skill. Especially in the world of games.
Help us help you: attach a .love.
Re: please help
Duolingo! I found out about that app through All About Android and I'm happy I did! It's a lot of fun!Robin wrote:luislasonbra, it might be useful to check out Duolingo, you can learn English there and knowing English is a really useful skill. Especially in the world of games.
"In those quiet moments, you come into my mind" - Liam Reilly
- luislasonbra
- Citizen
- Posts: 60
- Joined: Sun Jun 24, 2012 1:57 pm
Re: please help
thanks I've managed to do what he wanted.
here I leave the file love
here I leave the file love
Who is online
Users browsing this forum: No registered users and 9 guests