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.

Author
Message
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 9th Nov 2010 05:04 Edited at: 21st Nov 2014 23:16
Hello, everybody! I have been noticing two problems with spites lately: Sprites seem very blurry compared to the real image and sprites do not stay the same size as i resize a window, and when i put a sprite in a program, it isn't the correct size. Any help on how to get rid of these problems is greatly appreciated!

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Nov 2010 13:55 Edited at: 9th Nov 2010 13:56
Quote: "Sprites seem very blurry compared to the real image"

Are you loading using the texture flag?

Load Image "imagename.jpg",1,1

Quote: "and sprites do not stay the same size as i resize a window"

If you mean when you re-size by dragging the border of the window then no it won't. DBP creates a bitmap which is rendered into the window at a fixed size (EDIT: it stays the same as the window size).

CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 9th Nov 2010 17:39
Barthax - How do you set the the texture flag for sprites created using the create animated sprite command?

CSL
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Nov 2010 17:51
Quote: "Barthax"

=syntax error

You set the texture flag when you load the image (as I showed you) to avoid the automatic creation of Mip Maps, on reflection though I'm not sure this will help. Try it anyway though.



CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 9th Nov 2010 18:05
Quote: "You set the texture flag when you load the image (as I showed you) to avoid the automatic creation of Mip Maps, "


Barthax - I don't think you understood my question. Please read carefully.

My understanding is that when you have an image composed of multiple frames, you use the CREATE ANIMATED SPRITE instead of the LOAD IMAGE command. While the LOAD IMAGE command provides a texture parameter, the CREATE ANIMATED SPRITE does not. So again, how do you set the texture flag for sprites created using the CREATE ANIMATED SPRITE command?

CSL
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 9th Nov 2010 18:29
Quote: "Quote: "Barthax"
=syntax error
"


And then

Quote: "Barthax - I don't think you understood my question."


Too funny :')

C0wbox
20
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 9th Nov 2010 19:07
Lol, Barthax, that's a good one. xD

CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 9th Nov 2010 19:20 Edited at: 9th Nov 2010 19:25
Holy cr*p, it took me a while to "get" the joke!

My apologies baxslash (copied and pasted!)


The question still stands, though :p

PS: Barthax is the screen name from one of the members of the twingalaxies forums. That's the source of my confusion.

CSL
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 9th Nov 2010 19:43 Edited at: 9th Nov 2010 19:44
>Edit<
Didn't read it properly myself, sorry

What I would do is write my own "create animated sprite" function, using load image, get image and a couple of for/next loops for the x and y.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Nov 2010 22:04
CSL - I don't think you understood my (potential) answer.

Don't you still need to use an image number for the "create animated sprite" command?

How are you loading the image without using "load image"?

What I'm suggesting is you'll retain image quality if you use the texture flag when loading the image (I think).

Another possible answer might be if you are rotating the sprite, DBP produces horrible looking rotated sprites.

Quote: "Lol, Barthax, that's a good one. xD"

Reminds me of 'Trigger' from 'Only fools and Horses'... (UK TV show)

=Prof=
Good idea, using "Steve's famous image splitter" perhaps?


CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 9th Nov 2010 23:58 Edited at: 10th Nov 2010 00:25
Quote: "CSL - I don't think you understood my (potential) answer.
Don't you still need to use an image number for the "create animated sprite" command?"


LOAD IMAGE is not necessary when you use CREATE ANIMATED SPRITE, well, at least that's how I learned to use it. And yes, you specify an image number with CREATE ANIMATED SPRITE, but can't specify the texture flag as with LOAD IMAGE.

Quote: "How are you loading the image without using "load image"?"


I found something interesting:
Run this code first (Media attached)



Look at the image quality. Looks blurry because the texture flag is not set.

Now try this with the texture flag:



Sprite looks better. Nothing new here, just to make sure you notice the differences before moving with the next example.

Now try this code:


Looks like the CREATE ANIMATED SPRITE automatically sets the texture flag ON. Notice I did not use LOAD IMAGE on the last snippet. This is the way I learned to load sprites with multiple frames. I'm not sure why and how the texture flag works here. Using a LOAD IMAGE does not make a difference as shown next.



Looks like the CREATE ANIMATED SPRITE acts as a LOAD IMAGE "morg.bmp",1,1. It makes sense, since you still have to define the sprite afterwards. The only question is why the CREATE ANIMATED SPRITE command sets the texture flag on by default. (I mean, that's what I'm observing)

CSL
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Nov 2010 01:16 Edited at: 10th Nov 2010 01:20
Use LOAD IMAGE after CREATE ANIMATED SPRITE to turn off the texture flag if you wish. The image for CREATE ANIMATED SPRITE is really just to calculate the size of each frame of the target image. Once that's done manipulate the image all you want or reload an entirely different image in it's place.



I think it's on by default because if you're going to animate sprites 99% of the time most of us want perfect sprites rather than blurry sprites.

CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 10th Nov 2010 01:31 Edited at: 10th Nov 2010 01:37
Very interesting. I wonder why LOAD IMAGE defaults to blurry sprites, though.

Thanks for your input Grog, it's Grog, right?

CSL
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 10th Nov 2010 01:32 Edited at: 21st Nov 2014 23:17
Thanks for replying everybody, the texture flag seems to have helped! But what i mean when i say that the sprite is kinda what you said---It stays a certain size in relation to the window. Whenever i load a large sprite, it shows up very small on the screen. I try to make a sprite the size of the window so it fills it, but it becomes a big ordeal... I just want to be able to take the image size, scale the window to that, then it would fill the window. Thanks for all your replies!

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Nov 2010 04:42
LOAD IMAGE probably defaults that way because none and zero usually mean the same (no texture flag and texture flag zero).

Yeah I'm fine with just being called Grog... it's faster to type than my full name.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Nov 2010 09:38
So setting the texture flag to 1 when loading the image works right? Just that you have to 're-load' the image after setting the animated sprite up or am I misreading?

Grog sure knows his stuff when it comes to images

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Nov 2010 17:18
Quote: "So setting the texture flag to 1 when loading the image works right? "


Yeah, but there's really no need to load the image before CREATE ANIMATED SPRITE since it automatically sets the texture flag to 1.

Quote: "Just that you have to 're-load' the image after setting the animated sprite up or am I misreading?"


You only load the image after CREATE ANIMATED SPRITE if you want the animation to use texture flag 0 (using LOAD IMAGEs texture flag).

Quote: "Grog sure knows his stuff when it comes to images"


Thanks. It comes from making lots and lots of programs with sprites.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Nov 2010 17:25
Quote: "Yeah, but there's really no need to load the image before CREATE ANIMATED SPRITE since it automatically sets the texture flag to 1."

...but isn't there a parameter in "create animated sprite" for an image number? You would have to load something or it would throw an error "image does not exist at line..." wouldn't it?

CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 10th Nov 2010 17:50 Edited at: 10th Nov 2010 17:54
Quote: "...but isn't there a parameter in "create animated sprite" for an image number? You would have to load something or it would throw an error "image does not exist at line..." wouldn't it?"


yes, you specify an image number with CREATE ANIMATED SPRITE, but can't specify the texture flag as with LOAD IMAGE. However, as Grog confirmed (and I observed ), the texture flag is On by default using CREATE ANIMATED SPRITE. If there's a requirement to set the texture flag to Off, then a LOAD IMAGE without the texture flag should follow the CREATE ANIMATED SPRITE command.

CSL
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Nov 2010 19:21
@ Baxslash:

Adding to what CSL said:

With CREATE ANIMATED SPRITE you specify the filename of the image too so it knows which image to load for that image number. It automatically loads that image as if we used the LOAD IMAGE command ourselves with a texture flag of 1. It does many things that would take several lines of code if we did it manually.

Manual Animation:


The exact same thing with CREATE ANIMATED SPRITE and PLAY SPRITE:


That's why I love CREATE ANIMATED SPRITE and PLAY SPRITE.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Nov 2010 20:55
Aaah I see! I was remembering it wrong (no DBP at work), I thought it used an existing image. Sorry for the confusion...

=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 10th Nov 2010 21:06
@Baxslash
I made the same mistake after hastily reading the help files and posting earlier. Didn't notice the "filename" bit :$ lol

Why do I never notice obvious stuff like that until after I have posted it.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Nov 2010 22:00
Quote: "Why do I never notice obvious stuff like that until after I have posted it."

Story of my life...

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 11th Nov 2010 01:00 Edited at: 21st Nov 2014 23:17
Did anybody see my reply?

SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 11th Nov 2010 01:34
they just like 2 chat.
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 11th Nov 2010 01:40 Edited at: 11th Nov 2010 01:41
I paste a hidden sprite, scaled and rotated to size; rather than pasted images.

It's easy to work out the size of the screen vs the size of the original image used for the sprite, and then use the Scale Sprite command to scale the sprite accordingly before pasting it in the same way as you do with images

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Nov 2010 02:08
Quote: "Did anybody see my reply?"


This part?

Quote: "I just want to be able to take the image size, scale the window to that, then it would fill the window."


Yes, I see it. You can rescale images using bitmaps. Bitmaps (not .bmp files) allow us to manipulate images without the user seeing them. Consider bitmaps extra screens next to your monitor but out of sight. When you load a bitmap using a number other than zero (which is the main view screen) all 2D operations focus on that bitmap.

The following code snip rescales the attached image and shows it on the screen with PASTE IMAGE... you can use that image as a sprite if you wish but it's best not to if you're making a game with many sprites and any kind of sprite collision. At the bottom of the code snip there are two DELETE BITMAP commands. If the bitmaps weren't deleted I would of put a SET CURRENT BITMAP 0 command in there to change focus to the main view screen.




A cool quick way to rescale images is with Sven Bs Image Kit.

http://forum.thegamecreators.com/?m=forum_view&t=177340&b=5



Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 11th Nov 2010 02:38 Edited at: 21st Nov 2014 23:17
Thanks for the replies, lol! Now that image thingy looks like a plugin. I use code surge, would that accept plugins?

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Nov 2010 07:13
Quote: "I use code surge, would that accept plugins?"


Yes, it doesn't matter what IDE you use the plugins are copied into the Darkbasic Pro directory and are usually automatically loaded when you run your IDE (if not update the keywords).

Another great plugin is IanMs Matrix 1 Utilities Plugin. It's got a whole slew of commands that are a must-have if you're really serious about programming.

http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 20th Nov 2010 04:25 Edited at: 21st Nov 2014 23:17
So now im trying to make a tic tac toe game and i need transparency to work, so they say not to use the bitmap conversion thingys because that turns the alpha channel off. but then, because of that, automatically run into more size problems I really need help, im getting very impatient. i cant seem to figure out how to make things the right size in 2d, and my graphics drivers aren't allowing me to 3d model. but i love everybody's help!

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Nov 2010 09:39 Edited at: 20th Nov 2010 09:41
Quote: "So now im trying to make a tic tac toe game and i need transparency to work, so they say not to use the bitmap conversion thingys because that turns the alpha channel off."


To keep the alpha channel of pics grabbed with GET IMAGE you have to use SET BITMAP FORMAT to allow all bitmaps after that command to retain any transparencies.

The following code is like my last one but with a pic that's 50% transparent (attached image). It turns on the ability to grab transparencies with SET BITMAP FORMAT 21 (32 bit alpha, red, green, blue). It also draws some lines before showing the semi-transparent pic so you can see through the pasted image.



Quote: "I really need help, im getting very impatient. i cant seem to figure out how to make things the right size in 2d, and my graphics drivers aren't allowing me to 3d model. but i love everybody's help!"


The easiest way get just the right size for any of your programs is with a graphic editor. I use Paint Shop Pro for any project I'm doing. I first decide how big I want my resolution (640x480 or 800x600 or 1024x768) then create a blank screen that size. I load up any graphics I want and put them on their own layers on the same image. Layering allows us to move graphics around the screen (in the graphic editor) without effecting the other layers. Once all the graphics are in place and I like the look I use the coordinates shown in the lower left of the screen (the x and y where the mouse is) to place each image (or line or dot) exactly where I want everything to be.

http://en.wikipedia.org/wiki/2D_computer_graphics#Layers

If you can't or don't want to buy Paint Shop Pro try Gimp that's totally free:

http://www.gimp.org/

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 20th Nov 2010 17:33 Edited at: 21st Nov 2014 23:17
cool, thank you very much! Haha, i fixed my driver issue last night and i have these things figured out. Actually gimp is what i use

Login to post a reply

Server time is: 2026-07-21 18:37:52
Your offset time is: 2026-07-21 18:37:52