Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / how can i get my jump animation to work with jumping

Author
Message
raixgambit
12
Years of Service
User Offline
Joined: 25th Oct 2010
Location:
Posted: 2nd Nov 2010 05:38


do:me/repeat that again
until im done
loop

Attachments

Login to view attachments
LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 4th Nov 2010 19:57
By calling sprite s,x,y,s every loop, I don't think it will ever play your animated frames.

You need to establish a variable that controls the status of your character. For example, when the right key is pushed, you update the status variable and set the lower and upper frames for the play sprite command. During the main loop, if the status is jumping or moving right, you play the sprite, otherwise you just call sprite s,x,y,s.

Any chance you could upload the sprite images (or email them to me if you don't want to post here). I would be easier to check it if I had them.

I'm not really a programmer.....I only play one on TGC.
raixgambit
12
Years of Service
User Offline
Joined: 25th Oct 2010
Location:
Posted: 6th Nov 2010 04:55


heres the image

do:me/repeat that again
until im done
loop
LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 6th Nov 2010 15:20
That is a .gif image and not two .png images as listed in your code. If you need to convert it, you could use GIMP, which is free. Here is the link:
http://www.gimp.org/downloads/ It is worth noting that I do not endorse the use of copyrighted material unless one has written permission to do so.

You are using two different sprites for the same character. While this can be done, it would be unusual to do it that way. If you wanted to do that, you would always have to hide one of the sprites. This creates an unnecessary complication in your coding. It would be better to rework the images so that you can use them in the game properly.

There are a couple of ways you can handle getting the images:
1. You can copy/paste the images you want from it (for running and jumping) into one separate bitmap, equally spacing the images so that they line up correctly. This would be necessary if you are going to use CREATE ANIMATED SPRITE.
2. You can code it so that the images are pulled off of the bitmap manually and you can then manually animate the sprite.

I have done it both ways and I prefer method 2 myself. Using an animated sprite has it's difficulties, as there is no SPRITE PLAYING() command in DBP. Therefore, you have to look at the frame to see which animation is playing when accepting input from the user. You could do something like
at the top of your Do - LOOP and then check the frame when the user presses another key.

PLAY SPRITE has to be called every DO-LOOP iteration in order to work correctly. You could do this by changing the starting and ending frames within your code based upon the key pressed.

I hope this is helpful. Please post if you need further assistance.

I'm not really a programmer.....I only play one on TGC.
raixgambit
12
Years of Service
User Offline
Joined: 25th Oct 2010
Location:
Posted: 7th Nov 2010 04:09
how can i make my sprite jump smoothly though... basically if i press upkey i can make it's y jump up 40 . how do i make it fall down so all goes smooth so it is in 1 motion

do:me/repeat that again
until im done
loop
LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Nov 2010 04:11 Edited at: 9th Nov 2010 03:02
You need to control the sprite's movement using variables. Working code is worth a 1000 words:





I have attached the .png file that I made from your .gif image that is used in the code. It should be pretty straightforward, so I did not add comments to it.

You can move left or right, even while jumping. I realize the frames are not exactly lined up, but it is only to give you a working example to answer your question.

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
17
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Nov 2010 17:28
I love your new signature LBFN.

LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 9th Nov 2010 19:50 Edited at: 10th Nov 2010 19:04
Thanks Grog

I figured it was about time I got around to doing something with my sig .

Grog Grueslayer
Valued Member
17
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Nov 2010 02:39
Np. The new-new signature is even better.

I've felt that from newbies many times but they didn't scare me as much as ED-209 does. He will get his codez.

LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Nov 2010 03:50 Edited at: 18th Nov 2010 16:14
It's kindof funny, because I gave the OP teh codez.....So, what ever happened to the OP?

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
17
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 12th Nov 2010 17:49
I figured he was happy you gave him da codez and forgot about this thread.

Neco
14
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 17th Nov 2010 20:49
Can I get a sig for

"Gimme da 1337 graphiocs spritez" ?

Cause that's about the only way I'll ever get original art for a 2D game!

LBFN
15
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 18th Nov 2010 16:10 Edited at: 19th Nov 2010 17:50
=D

Login to post a reply

Server time is: 2022-12-09 08:47:32
Your offset time is: 2022-12-09 08:47:32