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.

Dark GDK / How to make images move like sprite at a press of a button(yes its me again)

Author
Message
yahya
15
Years of Service
User Offline
Joined: 16th Oct 2008
Location:
Posted: 25th Oct 2008 04:44
I know I been asking too many questions, but I really need to know a lot of thigns in a short time, so plz pare with my noob-ness.

Ok I want to knowjow, when I press up or down arrow button, or just do nothing, a set of images sart looping like a sprite would, for example when am doing nothing I want to dbload this image:

http://img232.imageshack.us/my.php?image=sfstrider1el9.gif

and when I press Space button, a set of iamges start moving once like this:

http://img232.imageshack.us/my.php?image=striderlongcuttd2.gif

sorry again for asking for a lot of easy stuff, but I been trying to understand how the tutorial did it in dark invaders sln game for like for ever, and still I can't move sprites like that game does.
Tav
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location:
Posted: 25th Oct 2008 18:06
Have a look at the Main.cpp of the Dark GDK - 2D Game when you start a project. That should help you solve your problem.
yahya
15
Years of Service
User Offline
Joined: 16th Oct 2008
Location:
Posted: 25th Oct 2008 20:33
I did, the sprites they use if one full image of different frame movements, I don't know how to creat a sprite like that, I want to move it on screen like how normal sprites do.
Tav
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location:
Posted: 26th Oct 2008 02:56
First think of how many frames you will be need. Let's say 12. So create a new image with paint or photoshop or something. So let's say your image is about width: 40 pixels height: 50pixels. Well then make the width of the image 40pixels x 12 = 480 pixels and a height of 50 pixels. Now place the frames you want to play in every area of 40pixels on 50 pixels. Color the background to a specific color if you want it to be transperant.

K, so that's your images. Now the programming part.

dbCreateAnimatedSprite(2, "Sprite.bmp", 12, 1, 2); See the 12 and the 1 after "Sprite.bmp"? Well they refer to the amount of areas you made in your image. Then use dbPlaySprite(2, 1, 12, 60) for the thing you do when hitting up.
yahya
15
Years of Service
User Offline
Joined: 16th Oct 2008
Location:
Posted: 26th Oct 2008 21:29
wait the 12 and 1 are the width and height, but the sprite is like 40 piexels and 50, shouldn't I put them 4 and 5 then for each pic size or am I just so wrong, that I should shutup
Venge
18
Years of Service
User Offline
Joined: 13th Sep 2006
Location: Iowa
Posted: 26th Oct 2008 23:31
Quote: "wait the 12 and 1 are the width and height, but the sprite is like 40 piexels and 50, shouldn't I put them 4 and 5 then for each pic size or am I just so wrong, that I should shutup"


The 12 and 1 refer to how many times DarkGDK should divide the image into frames. If you've got 12 frames of animation side by side making a 480x50 pixel image, you want the width to be 12(each frame uses 1/12th of the width of the image) and a height of 1(each frame uses the entire height of the image).

Hope that helped.

I have CDO. It's like OCD, but the letters are in alphabetical order, like they should be.
yahya
15
Years of Service
User Offline
Joined: 16th Oct 2008
Location:
Posted: 28th Oct 2008 02:47
^ ya I got it, but when I tried to put this type of .png sprite, it wont work:

http://img372.imageshack.us/my.php?image=stridersheetej9.png

isn't it 5 for width and 4 for height for this one?
Tav
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location:
Posted: 28th Oct 2008 10:57 Edited at: 28th Oct 2008 11:46
You almost got it but their all the same pictures. Remember when you play an image it will show every image with a specific delay. So for example: you have a man waving, you need the start image(when he holds his hand up) then you need a second image when his in the middle of his wave, and then when his hand is at the right. Ofcourse you may use more frames. So the only thing you need to do is set up each frame of http://img232.imageshack.us/my.php?image=striderlongcuttd2.gif in another area, so when he hold his sword is the first frame, when he pulls the sword back its the second amount of frames(suggest 3) and when he strikes make other frames. Instead of always the same image as you did with http://img372.imageshack.us/my.php?image=stridersheetej9.png.
EDIT: if you have imageready you can see each frame.
EDIT 2: Well I made it for you so you can see how to do it(NOTE: I took the size of a frame , but I realised there was a frame with a higher height, so I just deleted a part of that frame (2 frames actually :p)
Workspace: http://img510.imageshack.us/img510/2074/adobephotoshople2.png
Finished: http://img291.imageshack.us/img291/3815/warriormo9.png
yahya
15
Years of Service
User Offline
Joined: 16th Oct 2008
Location:
Posted: 28th Oct 2008 12:35
lol opps, the sheet i done was suppose to like look like this http://img517.imageshack.us/my.php?image=sfstrider1mk7.gif, guess I didn't notice it since I been working on this like forever,I didn't have notice that the same frame lol.

Tnaks man, that really really helped , I just got the main idea of this, and the sheet you did is working just fine, thanks again.

Tav
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location:
Posted: 28th Oct 2008 13:18
No problem

Login to post a reply

Server time is: 2024-09-30 09:25:16
Your offset time is: 2024-09-30 09:25:16