January 20, 2021, 10:55:55 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] Funky 3D titlescreen by _33 [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] Funky 3D titlescreen by _33 [ 1+ years ago ] (Read 1385 times)
BlitzBot
Jr. Member
Posts: 1
[bb] Funky 3D titlescreen by _33 [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:43 AM »
Title :
Funky 3D titlescreen
Author :
_33
Posted :
1+ years ago
Description :
This is a 3D titlescreen I made for an older project that will never see light of day. So, I decided to post this code here. It's a small piece of code that basically stamps your game title as text on a bunch of 3D yellow pucks. After it ran the 650 frames, it then ends the program. But in the original code, it was looping between the title screen and the main game menu.
NOTE: This is old rookie code.
Code :
Code: BlitzBasic
AppTitle
"MAZEGAME"
;----------------------------------------------------------------------------------------
; Define Global things
;----------------------------------------------------------------------------------------
Graphics3D
1024
,
768
,
32
,
1
Global
fontsize# =
168
Global
ptr_fnt =
LoadFont
(
"Arial"
,fontsize#/
2
,
True
,
False
,
False
)
Global
scrollcycle =
0
Global
doing_nothing_fps =
0
Global
camera%, ptr_light%
Dim
sin_tb#
(
1079
)
,cos_tb#
(
1079
)
For
i=
0
To
1079
: sin_tb#
(
i
)
=
Sin
(
i
)
: cos_tb#
(
i
)
=
Cos
(
i
)
:
Next
;Dim getcos(3),getsin(3): getcos(0)=1: getcos(2)=-1: getsin(1)=1: getsin(3)=-1
init_title_screen
(
)
While
GetKey
(
)
=
0
IntitleLoop
(
)
RenderWorld
Flip
1
scrollcycle = scrollcycle +
1
:
If
scrollcycle >
359
Then
scrollcycle = scrollcycle -
360
If
doing_nothing_fps >
650
Then
Exit
Wend
close_title_screen
(
)
End
;----------------------------------------------------------------------------------------
; title screen management
;----------------------------------------------------------------------------------------
Function
init_title_screen
(
)
doing_nothing_fps =
0
camera =
CreateCamera
(
)
ptr_light =
CreateLight
(
)
LightColor
ptr_light,
0
,
0
,
0
RotateEntity
ptr_light,
90
,
0
,
0
AmbientLight
0
,
0
,
0
t_obj.object_info =
New
object_info
t_objptr =
CreateTexture
(
fontsize# *
2
,fontsize#,
256
)
t_objobject_type =
2
SetBuffer
TextureBuffer
(
t_objptr
)
ClsColor
255
,
255
,
0
Cls
Color
255
,
0
,
0
SetFont
ptr_fnt
Text
fontsize# *
1.5
,fontsize# *
0.75
,
"MAZEGAME"
,
True
,
True
t_tex = t_objptr
SetBuffer
BackBuffer
(
)
For
z =
1
To
6
For
x = -z
To
z
For
y = -z
To
z
t_obj.object_info =
New
object_info
t_objptr =
CreateCylinder
(
36
- z *
4
)
t_objobject_type =
1
RotateEntity
t_objptr,
15
* x,
0
,-
15
* y
ScaleEntity
t_objptr,
8
,
2
,
8
PositionEntity
t_objptr,
32
* x,
32
* y,
32
* z
EntityTexture
t_objptr,t_tex,
0
,
1
Next
Next
Next
CameraFogMode
camera,
1
CameraFogRange
camera,
64
,
224
End Function
Function
IntitleLoop
(
)
Local
lc#
If
doing_nothing_fps <=
250
Then
lc = doing_nothing_fps
AmbientLight
lc,lc,lc
EndIf
If
doing_nothing_fps >=
400
Then
lc =
(
650
- doing_nothing_fps
)
AmbientLight
lc,lc,lc
EndIf
lx =
(
cos_tb#
(
scrollcycle *
2
)
*
30
)
ly =
(
sin_tb#
(
scrollcycle *
2
)
*
30
)
LightColor
ptr_light, lx *
8
, ly *
8
, ly *
8
PositionEntity
ptr_light,lx,ly,
0
If
doing_nothing_fps <
500
Then
PositionEntity
camera,
0
,
0
,
(
cos_tb#
(
scrollcycle *
2
+
120
)
*
15
)
For
t_obj.object_info =
Each
object_info
If
t_objobject_type =
1
Then
TurnEntity
t_objptr,
0
,sin_tb#
(
scrollcycle *
2
+
270
)
*
2
, sin_tb#
(
scrollcycle *
2
)
*
2.5
EndIf
Next
EndIf
doing_nothing_fps = doing_nothing_fps +
1
End Function
Function
close_title_screen
(
)
For
t_obj.object_info =
Each
object_info
If
t_objobject_type =
1
Then
FreeEntity
t_objptr
ElseIf
t_objobject_type =
2
Then
FreeTexture
t_objptr
EndIf
Delete
t_obj.object_info
Next
End Function
Type
object_info
Field
ptr
Field
xpos#
Field
ypos#
Field
zpos#
Field
object_type%
End Type
Comments :
Yo! Wazzup?(Posted 1+ years ago)
No matter what I change the font to, I get an Error Message, "Font does not exist." (I did try saving the file)
Ked(Posted 1+ years ago)
With mine I had a MAV unless it was in debug mode.
Bankie(Posted 1+ years ago)
Wot Ked sed. Works in debug mode.
big10p(Posted 1+ years ago)
I still get a MAV in debug. Moving the Graphics3D call to before the LoadFont command fixed things, though.
_33(Posted 1+ years ago)
OOps
Fixed. I've also fixed the size of the text appearing on the pucks.
*(Posted 1+ years ago)
graphics3d in blitz3d always frees up all graphics, textures and fonts
John Blackledge(Posted 1+ years ago)
1) Change CreateCylinder(.. to CreateSphere(..2) Comment out the EntityTexture... line.3) Add below:EntityColor t_objptr,Rnd(255),Rnd(255),Rnd(255) ! SMARTIES !
_33(Posted 1+ years ago)
4) modify the ScaleEntity to ... ScaleEntity t_objptr,8,3,8Neat!
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] Funky 3D titlescreen by _33 [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal