Where is InitSprite3D()
Where is InitSprite3D()
I am a new PB user so i installed the last version of PB 64 bits. Installation no problem.
The is start reading the book "Programming 2D Scrolling Games". Up until chapter 12 all was good.
The only drawback was the 16 bits depth creating screen was not possible. I had to upgrad it to 32 bits.
But then i came up at example file 12_2 Rotating sprite. When i want to compiling the compiler give up an error that the InitSprite3D() is not a function.
O.k. then what is it. I look on this forum and only what i see is, when i look for InitSprite3D(), Examples with this Function.
Is this function in PB. YES or NO.
n.b. I wend back up until version 5.00. In that version the InitSprite3D() is compiling without any warnings.
If InitSprite3D() is gone what is the replacement Function to use it.
The is start reading the book "Programming 2D Scrolling Games". Up until chapter 12 all was good.
The only drawback was the 16 bits depth creating screen was not possible. I had to upgrad it to 32 bits.
But then i came up at example file 12_2 Rotating sprite. When i want to compiling the compiler give up an error that the InitSprite3D() is not a function.
O.k. then what is it. I look on this forum and only what i see is, when i look for InitSprite3D(), Examples with this Function.
Is this function in PB. YES or NO.
n.b. I wend back up until version 5.00. In that version the InitSprite3D() is compiling without any warnings.
If InitSprite3D() is gone what is the replacement Function to use it.
From my first self made computer till now I stil like computers.
Re: Where is InitSprite3D()
it's deprecated. InitSprite() is now the only command you need. The Sprite 3D-functions work with that as well. See the manual/help for further details and examples. The book is very old
Re: Where is InitSprite3D()
Normally the History section of the manual explains when a command has changed, but both InitSprite3D() and InitSprite() haven't been mentioned since 2002:
https://www.purebasic.com/documentation ... story.html
No wonder it was confusing for bfernhout - there's no documentation of this change.
https://www.purebasic.com/documentation ... story.html
No wonder it was confusing for bfernhout - there's no documentation of this change.
Re: Where is InitSprite3D()
What are the Sprite 3D functions?Derren wrote:The Sprite 3D-functions work with that as well.
Re: Where is InitSprite3D()
RotateSprite() TransformSprite() Zoom... for example.
Those required InitSprite3D() in past versions of PB.
Also, I think Alpha-Transparency required it as well.
By only using InitSprite() and not InitSprite3D() you could only set a single color as a transparent color and not use 32bit PNG images as sprites.
Those required InitSprite3D() in past versions of PB.
Also, I think Alpha-Transparency required it as well.
By only using InitSprite() and not InitSprite3D() you could only set a single color as a transparent color and not use 32bit PNG images as sprites.
Last edited by Derren on Sun Mar 04, 2018 1:16 am, edited 1 time in total.
Re: Where is InitSprite3D()
It's all mentioned in the history under the entry '17th September 2013 : Version 5.20 LTS'.Dude wrote:Normally the History section of the manual explains when a command has changed, but both InitSprite3D() and InitSprite() haven't been mentioned since 2002:
https://www.purebasic.com/documentation ... story.html
No wonder it was confusing for bfernhout - there's no documentation of this change.
Re: Where is InitSprite3D()
Oh, I see now. It says: "Removed: Sprite3D library (merged with regular sprite library)"Demivec wrote:It's all mentioned in the history under the entry '17th September 2013 : Version 5.20 LTS'.
I was searching for "InitSprite", which has no matches. Not so obvious when searching for a specific command.
Suggestion: Changes to specific commands should be explicitly named in the History, to avoid missing them like this, because the first thing someone does when a command doesn't work is search for it in the History to see why.
Re: Where is InitSprite3D()
It can help. I've done a lot of review and updates of old code and I will usually search for the library name as well as the command. If I hit on something I can refer to the Help Manual from the version before it was changed/updated/removed, according to the History.Dude wrote:Oh, I see now. It says: "Removed: Sprite3D library (merged with regular sprite library)"Demivec wrote:It's all mentioned in the history under the entry '17th September 2013 : Version 5.20 LTS'.
I was searching for "InitSprite", which has no matches. Not so obvious when searching for a specific command.
Suggestion: Changes to specific commands should be explicitly named in the History, to avoid missing them like this, because the first thing someone does when a command doesn't work is search for it in the History to see why.
Re: Where is InitSprite3D()
The problem for me is. I never used PB untile 01-02-2018 and the latest version. I was thinking that that wat the best to start. But then i start reading a lot of things and everywhere i came the InitSpirte3D() and more.. are used in examples.
even the site http://www.ninelizards.com/purebasic/pu ... sprite3d() mention it. And some examples use also some functions that i cant find anywhere. I can understand that all functions on sprite"3D" is transformed to the normal sprite functions. But still i am missing some function where i do not know the replacement of it.
e.g. CreateSprite3D(n,#i_rock). I think its actualy just from a load sprite funciton. Like
LoadSprint((#i_rock,"data\geebee2.bmp",#PB_Sprite_Texture) : Where #i_rock equals 1
so i can lose the CreatSprite3D() function completely.
Am I right here?
even the site http://www.ninelizards.com/purebasic/pu ... sprite3d() mention it. And some examples use also some functions that i cant find anywhere. I can understand that all functions on sprite"3D" is transformed to the normal sprite functions. But still i am missing some function where i do not know the replacement of it.
e.g. CreateSprite3D(n,#i_rock). I think its actualy just from a load sprite funciton. Like
LoadSprint((#i_rock,"data\geebee2.bmp",#PB_Sprite_Texture) : Where #i_rock equals 1
so i can lose the CreatSprite3D() function completely.
Am I right here?
From my first self made computer till now I stil like computers.
Re: Where is InitSprite3D()
Yes, you are right. Here is/was the general idea of 3D sprites: you created a sprite and drew it's image (or loaded it) and then you created a separate 3D sprite that used the image of the first sprite as a texture or source image. It was always a 2 step process and so it was a good idea that the two libraries (sprite & sprite3D) were combined.bfernhout wrote:so i can lose the CreatSprite3D() function completely.
Am I right here?
Here is an example from the area you referenced with some simple cleanup:
Code: Select all
; survival guide 6_4_4_150 rotatesprite3d
; pb 4.60b4 ;upated to v5.62
;
Enumeration
#w_main
#spr_player
#spr_rock
;
#f_exit
#f_none
EndEnumeration
;
Structure object
sprite_nr.i
x.i
y.i
width.i
height.i
intensity.i
color.i
zoom.i
rotate.f
dx.i
dy.i
di.i
dc.i
dz.i
dr.f
EndStructure
;
Global NewList objects.object()
;
InitKeyboard()
InitSprite()
; Let's enumerate all the screen modes found and look for highest resolution and depth
If ExamineScreenModes()
While NextScreenMode()
If ScreenModeDepth() >= screen_depth And ScreenModeWidth() >= screen_width And ScreenModeHeight() >= screen_height
screen_depth = ScreenModeDepth()
Screen_width = ScreenModeWidth()
screen_height = ScreenModeHeight()
framerate = ScreenModeRefreshRate() / 2
EndIf
Wend
EndIf
;
; OpenScreen(screen_width,screen_height,screen_depth,"Test",#PB_Screen_NoSynchronization)
;
OpenScreen(screen_width,screen_height,screen_depth,"Test",#PB_Screen_WaitSynchronization)
;
; framerate = 120
; SetFrameRate(framerate)
;
;
CreateSprite(#spr_player,64,64)
CreateSprite(#spr_rock,64,64)
;
StartDrawing(SpriteOutput(#spr_player))
Box(0,0,63,63,RGB(0,0,0))
FrontColor(RGB(0,255,0))
LineXY(4,60,32,4)
LineXY(32,4,60,60)
LineXY(60,60,32,16)
LineXY(32,16,4,60)
StopDrawing()
StartDrawing(SpriteOutput(#spr_rock))
Box(0,0,63,63,RGB(0,0,0))
FrontColor(RGB(255,255,255))
LineXY(4,60,32,4)
LineXY(32,4,60,60)
LineXY(60,60,38,16)
LineXY(38,16,54,6)
LineXY(54,6,43,34)
LineXY(43,34,60,60)
LineXY(60,60,10,35)
LineXY(10,35,4,60)
StopDrawing()
;
AddElement(objects())
With objects()
\sprite_nr = #spr_player
\x = Random(screen_width)
\y = Random(screen_height)
\width = 64
\height = 64
\intensity = 255
\color = RGB(0,255,0)
\zoom = 64
\rotate = Random(360)
\dx = 1+Random(5)
\dy = 1+Random(5)
\di = 0
\dc = 0
\dz = 0
\dr = 1
EndWith
;
maxObjectCount = 5 ; *** 5 or 500
For n = 1 To maxObjectCount
AddElement(objects())
With objects()
\sprite_nr = #spr_rock
\x = screen_width / 2 ;Random(screen_width)
\y = screen_height / 2;Random(screen_height)
\width = 64
\height = 64
\intensity = Random(255, 180)
\color = RGB(Random(255, 0), Random(255, 0), Random(255, 0))
\zoom = Random(64, 4)
\rotate = Random(360)
\dx = -1-Random(5)
\dy = -1-Random(5)
\di = (Random(3, 1) - 2) * 3
\dc = (Random(7, 1) - 4) * 3
\dz = (Random(9, 1) - 5)
\dr = 0.0 + (Random(11, 1) - 6) + (Random(512) - 256) / 1024
EndWith
Next n
;
action = #f_none
Repeat
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
action = #f_exit
EndIf
;
ClearScreen(0)
ForEach objects()
With objects()
If \x > screen_width - \width
\dx = -1-Random(5)
EndIf
If \x < 0
\dx = 1+Random(5)
EndIf
If \y > screen_height - \height
\dy = -1-Random(5)
EndIf
If \y < 0
\dy = 1+Random(5)
EndIf
change + 1
If change > 10
\intensity + \di
If \intensity > 255 Or \intensity < 0: \di = -\di: \intensity + \di: EndIf
\color + \dc
If \color > 16777216 Or \color < 0: \dc = -\dc: \color + \dc: EndIf
\zoom + \dz
If \zoom < 8 Or \zoom > 128: \dz = -\dz: \zoom + \dz: EndIf
change = 0
EndIf
\x = \x + \dx
\y = \y + \dy
\rotate = Mod(\rotate + \dr, 360)
;
ZoomSprite(\sprite_nr, \zoom, \zoom)
RotateSprite(\sprite_nr, \rotate, #PB_Absolute)
DisplaySprite(\sprite_nr, \x, \y) ;comment this line and uncomment the next one to see some other effects
;DisplayTransparentSprite(\sprite_nr, \x, \y, \intensity, \color)
EndWith
Next
;
FlipBuffers()
Until action = #f_exit
CloseScreen()
Re: Where is InitSprite3D()
Thanks for the help here. Its give me a lote of help. I started to write a tutorial (more book where they make a complet game) for PB5.56 But only in dutch. So i could help a lot of young people who are willing to use PB but could not yet read or speak Englisch. And some older to.
I was first thinking of leaving the 3D sprite stuff out of the book. But as i see by myself its better to keep it in the book but say its absolete and better to use the normal sprite library.
This part is not going in at the start but more as a advance part where it wil be placed under NOT IN USE ANYMORE. So when they try a source code and get the errors they know why and maybe how to solve them.
i have a lot of code worked out and slowly getting somewhere with the book.
I was first thinking of leaving the 3D sprite stuff out of the book. But as i see by myself its better to keep it in the book but say its absolete and better to use the normal sprite library.
This part is not going in at the start but more as a advance part where it wil be placed under NOT IN USE ANYMORE. So when they try a source code and get the errors they know why and maybe how to solve them.
i have a lot of code worked out and slowly getting somewhere with the book.
From my first self made computer till now I stil like computers.
Re: Where is InitSprite3D()
Ran into the same issue but was on PB Survival Guide website (which I would have assumed to be more up to date than the 2d scroller book?). In any case, this thread answered my question.
It takes a bit of research for new users when reviewing existing tutorials.
It takes a bit of research for new users when reviewing existing tutorials.
Gary E Chike DMD MS
'Experience is what you get when you don't get what you want'
'Experience is what you get when you don't get what you want'
Re: Where is InitSprite3D()
In the same code, PB compiler states "Constant not found: #PB_Sprite_Texture", I looked in the help file under history but could not find whether this was deprecated our not. Also the search engine within the forum omits 'PB" and searches 'sprite' and 'texture' which leads to a lot of dead ends.
Gary E Chike DMD MS
'Experience is what you get when you don't get what you want'
'Experience is what you get when you don't get what you want'
Re: Where is InitSprite3D()
Thanx Lord for the link in the forum.
Gary E Chike DMD MS
'Experience is what you get when you don't get what you want'
'Experience is what you get when you don't get what you want'