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.

Newcomers DBPro Corner / Clipping (animation)? (2d)

Author
Message
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 6th Aug 2006 02:47 Edited at: 6th Aug 2006 02:48
hello everyone.
i plan on designing a 2D side scroller/platform game. i am wondering how too go about clipping (animating) a sprite.
i designed a simple image (32x96) so 3 sprite sizes wide. it is a picture of a bouncingball. i am wondering how too go about clipping out the 32x32 images and animating it so it goes up and down.
here is my image:



my current transparency color is pink (rgb 255,0,255)
here is my image. A lil code snippet of how too make this play maybe even remmed out or a lil tutorial would help me bundles.

thank you for your time,
-Snow

Attachments

Login to view attachments
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 6th Aug 2006 02:47 Edited at: 6th Aug 2006 02:48
sry, accidental double post. dang internet connection
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 6th Aug 2006 09:26
Guys come on please help me out
Gamers for sale
18
Years of Service
User Offline
Joined: 19th Nov 2005
Location: Some where beneath the elements
Posted: 7th Aug 2006 17:38 Edited at: 7th Aug 2006 19:03
Well I would suggest a program to cut the sprite into several images then save it as an animated gif file. One way of doing this is download game maker from gamemaker.nl and you can use the sprite button to open and edit the sprite so it will be an animated gif file. If you are using DBpro then you can load an animated sprite. I haven't tried if gif files work for this command in DBpro but it's worth a try. Another way to do this would be to cut them up into several images, load them, hide and show the sprite, and position the sprites all in the same area. There might be a way to do this in code for DB but I haven't figured it out yet. !!!!!!!Edit: Or use CJD's idea!!!!!!!

Hope this helps
CJD
18
Years of Service
User Offline
Joined: 15th Mar 2006
Location:
Posted: 7th Aug 2006 18:49
Use the create animated sprite command and the play sprite command.

E.G. created animated sprite 1,"ball.bmp",1,3,1

DBPRO newbie
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 7th Aug 2006 21:51
This something i made, and modified it to apply to you bouncingball. Also, i edited your pic so to have a better animation going.



I also uploaded the pic of the bouncingball. Hope it helps and gives you some ideas.

Attachments

Login to view attachments
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 7th Aug 2006 21:52 Edited at: 7th Aug 2006 21:53
Sorry for the double post.
Here's a gif of how i expected the animation to go...

Attachments

Login to view attachments
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 7th Aug 2006 22:28 Edited at: 7th Aug 2006 22:30
wow nice.. just wow, i cant thank you enough. even with a jumping code!
i couldent be more set. thank you so much
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 7th Aug 2006 22:37 Edited at: 7th Aug 2006 22:39
Actually, this is the code with no side notes:


The code is quite long if you looking just to animate the ball jumping, but i thought you'd like to have control of it, as if it were the player, so things got complicated.
Indeed you can make a simple animation of it with just a few lines, but you'll end up having no control over the spot, good if you want it as part of an animation, or like a cursor, something you won't be interacting with, not like the player itself.
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 7th Aug 2006 22:41
Sry for double post, Zergei i have some questions.
i read the other post how u were helpin the guy with his map editor and exporting the code etc.
i am making a map editer and it is turning out very nice. i have noticed u seem very expiecienced in the ways of 2d so here are some questions i have. just say you dont know if you dont

1) if you use bluegui how do you paste an image on top of a gadget.
2) in the code you wrote for the guy about data statements (
) i do not 100% understand how the data statements corispond with the pasteing of the images.

3) When exporting code could i read the data statements from a text file that my tile editor sends out?

4) Thank you for your time, i will ask more here if i come up with new ones,

thx,
-snow
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 7th Aug 2006 23:11 Edited at: 7th Aug 2006 23:11
First of i did this in 15 min, as im on a hurry now.


Just reedited the code from above to make is a simple jumping spot.

Now, about those other questions...

1) Im have no idea what bluegui is, or what your refering to a gadget. If you could explain something more about it i may ( may not) now something about it.

2) The part were it says "Fill world array", loads the data statement to an array, wich will be used for the creation of the level. When you READ data statements, it starts from the very first data, wich is a 2. Then you must use the READ command again to grab the 2° data wich is a 2 (the one next to the first one), and so on. When it reaches the end of the line, then it goes to the next DATA. If thats what your not understanding, fine. However if its how i pasted the images using the paste, offset, and for loops, then re ask .

3) Yes, actually i've done 2 programs that help me with a characters animation sheet, and a map editor, but this last i did just the basic, as i started another project, still i may help you.

4) Glad i can help, im not that experienced yet, but looking forward it .
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 8th Aug 2006 01:02
kk sweet.
i have a few questions now, in
in the last part (the data statements) how would i load a txt file and give the data that data from the text file. lets say i have a text file with those data statements in it but i dont want too hard code it into the program. how would i do that
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 8th Aug 2006 04:33
In DbPro, press F1 to access the help, goto commands, option N°4 File Commands. There you have the commands to achieve it.

So, what you first do is open a file, but when you open it you must have in consideration what you're gonna do with it, say READ or WRITE. To read use "open to read" command, read the help to get an understanding of what goes along with it, the FileNumber, FileName. (but i doubt you won't understand that). To write use "open to write".

Once opened, you can read/write it, and what is important, make sure not to open another file and assign it the same number or error will happen. Also don't forget to CLOSE the FILE with the "Close file" command once your done with it, else it will keep stored in memory.

Once thats cleared, to read/write a file you use one of the many ways of reading/writing, accordingly to how you expect data to be. For strings use "Read String"/"Write String", for float values use "Read Float"/"Write Float", and for short amounts of data use byte "Read Byte"/"Write Word" or word "Read Word"/"Write Word" (in one variable, not in all the file, ex: use byte if you know you'll never surpase 256 values, else use WORD as it ranges to 65536).

Read and write using the same type of information, write bytes, read bytes, write strings, read strings....

Now, something to take into account. When reading strings, for each "Read String" command you call, you'll be grabbing a complete line. However, when using any of the other types, the program will grab the necesary ammount to complete that type. It'll be hard to write on your own a byte type file using notepad, so i recomend you work out in your own map editor a save function that will write a file in the type of data you wish.

Oh, and in order to write a file, it must first not exist, else error. Looks like you can't modify a file, so you'll have to read it, save it in an array, close it, delete it, and then write it.

Here's a quick example, anything else just ask:

Create a .txt file and write something in it.
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 8th Aug 2006 07:57
k nice.
i have a few more things too ask.
i cant seem too load the file and use it as data. at the end of the code were it says

how wuold unstead of saying all that data load a file and just use the file unstead of writing the data
Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 8th Aug 2006 14:09
Snowfall,

The data from the text file would never replace those DATA lines.

Try that last example of Zergei's, with a .txt file containing a first line that says "This replaces the first DATA statement". You should find that his example reads that from the file. A little mental leap, and you should see that you can put "1,2,2,2,1" as the first line of your .txt file, read it in, split it up and assign it to your variables.

"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library

First you Dream, then you ... - Neil Gaiman, 2001

Login to post a reply

Server time is: 2024-09-25 05:29:50
Your offset time is: 2024-09-25 05:29:50