need help showing sprites
Blitz3D Forums/Blitz3D Beginners Area/need help showing sprites
| ||
I am trying to put some sprite on the screen. My idea is to make a 2D game with 3d world. That mean some kind of jump and run game. But i want it to give a 3D look. So i want to use sprite and Apha of the sprites. But al what happend is not one sprite is showing; Mij test program isGraphics3D 800,600 ;maak orthographic camera cam = CreateCamera() ;create camera; CameraProjMode cam, 2 ;no perspective rendering PositionEntity cam, 0, 0, -512 ;camera to back CameraZoom cam, 0.313 ;800x600 AmbientLight 255, 255, 255 ;fullbright ;Stop SetBuffer BackBuffer() back = LoadImage("gfx\Main Screen Wood.png") spr = LoadSprite("gfx\Claw.png",1) ;camera=CreateCamera() ;light=CreateLight() test# = 0 Repeat DrawImage back,0,0 If KeyDown(200) Then test=test+1 If KeyDown(208) Then test=test-1 DebugLog test PositionEntity spr,MouseX(),MouseY(),test ;UpdateWorld Flip If KeyDown(1) Then End Forever The iamge back is drawing but the sprite not. And when i marked out the back i stil not see the sprite. Can someone tell me what is wrong. And make it a tut so in the future its handy. bart. |
| ||
There ya go Bart. Probably not exactly what you are looking for, but it may set you in the right direction. Graphics3D 800,600 SetBuffer BackBuffer() camera = CreateCamera() back = LoadSprite("gfx\Main Screen Wood.png", 4) ScaleSprite back, 2.5, 2 SpriteViewMode back, 1 PositionEntity back, 0, 0, 2, True spr = LoadSprite("gfx\Claw.png", 4) ScaleSprite spr, 0.05, 0.05 SpriteViewMode spr, 1 PositionEntity spr, 0, 0, 1 Repeat MoveEntity spr, (MouseXSpeed() * 0.01), (-MouseYSpeed() * 0.01), 0 UpdateWorld RenderWorld Flip Until KeyHit(1) End Last edited 2010 Last edited 2010 |
| ||
OOPS!, I almost forgot... Any images you draw in the background will be obscured by the 3D world, so make the background into a sprite and give it a higher "Z" value than the sprite you want appearing in front of the background to send it further into the distance. Last edited 2010 |
| ||
thanks everthing is working. now i have a stupid problem that the back picture have a big part of white inside the drawing and that is not showing correctly. but again your idea was very good. |
| ||
I have edited some of the above code. These two lines: back = LoadSprite("gfx\Main Screen Wood.png", 4) spr = LoadSprite("gfx\Claw.png", 4) Were originally: back = LoadSprite("gfx\Main Screen Wood.png", 1) spr = LoadSprite("gfx\Claw.png", 1) With the last parameters set to '1', you will get a semi-transparency thing going on. Best set them to '4' to make them appear solid. You can also set both PositionEntity 'z' values to '1' instead of '1' and '2', as long as you set the background's position first. Last edited 2010 Last edited 2010 Last edited 2010 |