sprites
BlitzPlus Forums/BlitzPlus Beginners Area/sprites
| ||
could somebody tell me where to store my sprite artwork so blitzplus can find them. this is driving me mad . what I want to know is what folder do I put them in. thanks |
| ||
what it says is this . type jpg not found or type png not found I've tried everything I can think of and just cant do it what file or folder do I have to put my artwork or images in for blitzplus to find them . please help |
| ||
Hey, first off it would be easy for someone to help you if you can post some snippet or the full code on what you're trying to do. |
| ||
AppTitle sprites Graphics 640,480 x=100 y=100 LoadImage (cross.jpg) .bug Text x,y,(cross.jpg) If KeyDown (1) Then Stop Goto bug Here it is . for now I just want to display an image on the screen. |
| ||
The current directory, as returned by CurrentDir(), is different when you run a program from the IDE and when you run a standalone exe. But SystemProperty( "AppDir" ) should tell you where your executable progam is. If your sprites are in a folder named \Sprites in the same folder as the exe then SystemProperty( "AppDir" ) + "\Sprites" should be the path to your sprites. |
| ||
Ok I see. There are a couple of errors that I can point out on that sample you posted, the quotes are missing, text does not go with images, etc.. If you're new to bplus, there are mostly examples on the online manual, like if you're trying to load an image, check out this example: ; LoadImage and DrawImage example ; Declare a variable to hold the graphic file handle Global gfxPlayer ; Set a graphics mode Graphics 640,480,16 ; Set drawing operations for double buffering SetBuffer BackBuffer() ; Load the image and assign its file handle to the variable ; - This assumes you have a graphic called player.bmp in the ; same folder as this source code gfxPlayer=LoadImage("player.bmp") ; Let's do a loop where the graphic is drawn wherever the ; mouse is pointing. ESC will exit. While Not KeyHit(1) Cls ; clear the screen DrawImage gfxPlayer,MouseX(),MouseY() ; Draw the image! Flip ; flip the image into view and clear the back buffer Wend Link: http://www.blitzbasic.com/bpdocs/command.php?name=loadimage&ref=goto If you're not familiar with a command, just go here and search for it: http://www.blitzbasic.com/bpdocs/docs.php And always save your code first then make sure it is on the same folder where your images or assets are located. That is the current directory that Floyd is also pointing out. Hope that helps. |
| ||
thanks for trying guys but still not working . could you please type it in exactly the same as it would appear in the program. it's saying type png not found. tried putting them in the same folder and still doing it. |
| ||
I think i'm doing something right its now saying invalid image handle . At least it found the file . |
| ||
This is what I've come up with so far. It fails at line 8 says invalid handle whatever that means what do you guys think. AppTitle sprites Graphics 640,480,16 SystemProperty( "AppDir" ) + "\Sprites" SetBuffer BackBuffer() x=100 y=100 LoadImage ("cross.png") DrawImage x,y,("cross.png") If KeyDown (1) Then Stop |
| ||
All I want to do is display a sprite or image on the screen right now . I must be close. |
| ||
I am not exactly new to basic but blitz basic is different to what I am used to. |
| ||
Look at RustiKristi's example on how to load and display images myimage = loadimage("cross.png") Drawimage myimage,x,y |
| ||
Here you go, just to confirm that the tutorial works with a supplied image on the same directory.. http://www.mediafire.com/download/wz9y275f56ph5s3/pfaber11.zip If you're not sure with your code or new to the engine/language, it's better to check out the examples and tutorials first and the best way to learn (at least for me) is to modify them and see first hand on how they work, procedure and syntax wise. |
| ||
Well I've looked at the example and it runs but is not displaying the image on the screen . Any ideas. this is as far as I've got. AppTitle sprites Graphics 640,480 SystemProperty( "AppDir" ) + "\Sprites" SetBuffer BackBuffer() myimage=LoadImage ("cross.png") x=100 y=100 .bug DrawImage myimage ,x,y If KeyDown (1) Then Stop Goto bug |
| ||
Well thanks for all your help guys . not quite there but almost. Thankyou |
| ||
Can you run any program in the samples directory? If not then I think there's something wrong with your installation. What's your computer spec? Win version, gfx card? |
| ||
When you run from the IDE everything goes ( temporarily ) in \BlitzPlus\tmp. So LoadImage is looking there. As a quick fix put the cross.png file in \tmp. The long term fix is to create a folder somewhere and put your .bb file in it. Create a Sprites folder in the same place as your source code. SpritePath$ = SystemProperty( "AppDir" ) + "\Sprites\" ; just SpritePath$ = "\Sprites\" might be good enough. LoadImage( SpritePath + "cross.png"You may still have to experiment with the details. I haven't done this in a long time. |
| ||
That should work, it's just it's missing the flip command Best option is create a folder save the blitzplus code file in that folder save the image in that folder then run the code with the flip command added AppTitle sprites Graphics 640,480 SystemProperty( "AppDir" ) + "\Sprites" SetBuffer BackBuffer() myimage=LoadImage ("cross.png") x=100 y=100 .bug DrawImage myimage ,x,y flip If KeyDown (1) Then Stop Goto bug |
| ||
well I've done it . it took me 2 days to get this down and I wouldn't of done it without you. a big thanks to all you guys . I've written a couple a programs over the last week but not using graphics but now i'm off . Thanks again . |