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! / Little Help with 2D Please

Author
Message
Nome
13
Years of Service
User Offline
Joined: 15th Oct 2009
Location:
Posted: 24th Nov 2009 17:14
hey there, first post.

I have had a look through some of the tutorials, and just need pointing in the right direction. i'm making a 2d game for a college project (as i found 3d was too memory intensive and was not worth it on DarkBasic Classic). I have a sprite sheet which have segmented and saved as seperate files, "runningright","Standing",etc.

What i am stuck with is changing the sprites when i press up,down left or right. i wasnt sure if to use arrays,variables. i hhave come across attributes like LOAD BIMAP and GET IMAGE but saw in a tutorial that it was better to use LOAD IMAGE.

Any help would be great thanks!

Attachments

Login to view attachments
MSon
18
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 24th Nov 2009 19:11 Edited at: 24th Nov 2009 19:13
Use this command to load the SpriteSheet


Then use this to Animate the Sprite


Or to set the sprite to a specific img, (Like Ducking/Jumping, use this)


Using these commands you can change the sprite image or animate it.

Everyone Be Cool, You, Be Cool.
Ashingda 27
14
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Nov 2009 03:53 Edited at: 25th Nov 2009 03:55
If it was up to me I'd save each frames into a separate image, but make sure you know where you saved it too. Might want to use a pointer.

For example:



Next step is the animation. I'd use an array for this:


These are the basics of the method I personaly use. There are no single correct way of coding and you can find many many ways to get the same effect, some being more or less effective as others in areas such as speed or memory consumptions, but as long as it works with you.

Login to post a reply

Server time is: 2023-01-29 06:30:23
Your offset time is: 2023-01-29 06:30:23