Posted: Wed Jun 09, 2010 8:10 pm Post subject: RE:Walking animation help
Listen to Insectoid, once again, he has pwned me and hopefully helped you solve your problem
Anyway, on missing that first attachment, and I never thought of keeping a stock image, but it sounds like a good idea, as it would come in very handy in going through some of the code I find in the help sections of this site.
Even though I probably won't be able to improve much on what help Insectoid has given you, I will look through the code regardless with the picture now at my disposal, and if I come up with anything, you'll find it here.
Sponsor Sponsor
Monduman11
Posted: Wed Jun 09, 2010 8:12 pm Post subject: Re: Walking animation help
ah kk i see what your getting at . thx insectoid ill try it out and see how it goes
Monduman11
Posted: Wed Jun 09, 2010 8:14 pm Post subject: Re: RE:Walking animation help
Cezna @ Wed Jun 09, 2010 8:10 pm wrote:
Listen to Insectoid, once again, he has pwned me and hopefully helped you solve your problem
Anyway, on missing that first attachment, and I never thought of keeping a stock image, but it sounds like a good idea, as it would come in very handy in going through some of the code I find in the help sections of this site.
Even though I probably won't be able to improve much on what help Insectoid has given you, I will look through the code regardless with the picture now at my disposal, and if I come up with anything, you'll find it here.
kk thx , and insectoid helped with the walking animation not the shooting thing, he just gave me a suggestion on how else i could do it
Cezna
Posted: Wed Jun 09, 2010 8:16 pm Post subject: RE:Walking animation help
Posted: Wed Jun 09, 2010 8:18 pm Post subject: Re: Walking animation help
ah kk thanks again lol
Insectoid
Posted: Wed Jun 09, 2010 8:24 pm Post subject: RE:Walking animation help
Shooting is pretty easy to do. Have a flexible array (or just a big enough regular array to hold the maximum number of shots possible on screen at a time) and whenever the 'shoot' button is pressed, add the character's x, y and direction coordinates to the array (either use 3 arrays for the 3 elements or a record if you know how). Then, in your main loop, have a separate loop that moves all the bullets (direction should be either -1 or 1 for ease of use). Keep a counter to control how soon a bullet can be fired off (set it to like, 10 or something and then decrement it every frame and don't let the gun fire unless the counter's less than 0, then set to 10 again). Or use Time.SinceLast or whatever it's called.
Monduman11
Posted: Wed Jun 09, 2010 8:27 pm Post subject: Re: RE:Walking animation help
Insectoid @ Wed Jun 09, 2010 8:24 pm wrote:
Shooting is pretty easy to do. Have a flexible array (or just a big enough regular array to hold the maximum number of shots possible on screen at a time) and whenever the 'shoot' button is pressed, add the character's x, y and direction coordinates to the array (either use 3 arrays for the 3 elements or a record if you know how). Then, in your main loop, have a separate loop that moves all the bullets (direction should be either -1 or 1 for ease of use). Keep a counter to control how soon a bullet can be fired off (set it to like, 10 or something and then decrement it every frame and don't let the gun fire unless the counter's less than 0, then set to 10 again). Or use Time.SinceLast or whatever it's called.
i already have the shooting thing and it works seperatly but when i try to add it to the game, whenever i press the shoot button the fireball is shot but it doenst blend in with the game it just shoots leaving a white line behind it
Insectoid
Posted: Wed Jun 09, 2010 8:31 pm Post subject: RE:Walking animation help
Does it freeze the rest of your game?
Sponsor Sponsor
Monduman11
Posted: Wed Jun 09, 2010 8:34 pm Post subject: Re: RE:Walking animation help
Insectoid @ Wed Jun 09, 2010 8:31 pm wrote:
Does it freeze the rest of your game?
no once the shooting is done the game continues to work, the only problem im having is that i cant seem to make it be one with the game
Insectoid
Posted: Wed Jun 09, 2010 8:40 pm Post subject: RE:Walking animation help
I assume your game looks a bit like this
code:
loop
%do stuff
loop
exit when bullet hits something
move bullet
end loop
%draw stuff
end loop
It really should look more like this
code:
var bullets: array 1..num_bullets of int %array of bullets
loop
%do stuff
for x: 1..num_bullets
move bullets(x) ONCE
end for
%draw stuff
end loop
What's happening in yours is when you fire a bullet, the program enters a loop which effectively pauses the program and focuses all its attention on moving that bullet. Rather, the bullet should be moved like a character; only once per loop. Moving two things at the same time is a vital part of animation and learning how will be invaluable.
Monduman11
Posted: Wed Jun 09, 2010 8:42 pm Post subject: Re: Walking animation help
ah kk ill try to edit my code and see if i can make it work if not ill keep on trying till i get it lol
Cezna
Posted: Thu Jun 10, 2010 11:47 am Post subject: RE:Walking animation help
You just need to redraw the background every time you move the fireball to prevent that white line from showing up, and use setscreen ("offscreenonly")