Introduction to 3D

Previous topic - Next topic

Jonás Perusquía

Hi, i have a game (DitraFall) where i show an image in the background and some text is displayed, but i would really like to scale that text to fit several screens, and i want to achieve this by doing this:

Code (glbasic) Select
SUB intro:
WHILE TRUE
rel.released();
STRETCHSPRITE 21,0,0,sx,sy
INC mn,1

X_MAKE3D 1,1000,45  // TEST FOR SCALABLE TEXT //
X_CAMERA 0, 0, 0, 0, 0, -1
SETFONT 8
IF PLATFORMINFO$("LOCALE") = "es"
X_PRINT "presenta...",sx/2-(LEN("presenta...",TRUE)/2), sy/1.5, -1, 1//TRUE // TEST FOR SCALABLE TEXT //
ELSE
X_PRINT "presents...",sx/2-(LEN("presents...",TRUE)/2), sy/1.5, -1, 1//TRUE // TEST FOR SCALABLE TEXT //
ENDIF
IF mn > 260
PLAYMUSIC "hola.mp3", TRUE
X_MAKE2D // TEST FOR SCALABLE TEXT //
IF PLATFORMINFO$("LOCALE") = "es"
GOSUB MENU
ELSE
GOSUB MENUE
ENDIF
ENDIF
SHOWSCREEN
rel.released();
WEND
ENDSUB


but no text is displayed :( is there something wrong with the X_CAMERA or X_PRINT commands i placed?

i already tried commenting the STRETCHSPRITE but still nothing displayed... thanks in advance :) you guys are awesome
<HTML><BASIC><EC>
Be free and do good things

mentalthink

#1
Hi jonaspm... you have a trouble whit the position of the text...

I look the sx and sy variables... You have change form 2D to 3D world... rebember not it's equal, put a print than X_print, X_print uses the 3D coordinates... them are very little than in 2D... (in this case take a look to X_screen2World or X_World2screen)

If you did this...

Try to change the position of the Camera... Camera not Target... Camera are the first 3, parameters and target are the last 3 paramenters...

In your code>>
X_CAMERA 0, 0, 0, 0, 0, -1   Here you are looking to your back.

sy/1.5, -1, 1                        Here your object it's put in front of you, a bit down,  but you are looking to rear... because                              you       target have 0,0,-1

I think this it's the problem.

; Try to put this
X_CAMERA 0, 0, -1, 0, 0, 100 

Jonás Perusquía

#2
Still can't see anything :(
I would like to scale text to different resolutions, just like sprites or animations
Code (glbasic) Select
X_MAKE3D 1,100,45  // TEST FOR SCALABLE TEXT //
X_CAMERA 0, 0, 0, 0, 0, 1
SETFONT 8
IF PLATFORMINFO$("LOCALE") = "es"
X_PRINT "presenta...",0-(LEN("presenta...",TRUE)/2), 0, 1.1, 1//TRUE // TEST FOR SCALABLE TEXT //
ELSE
X_PRINT "presents...",0-(LEN("presents...",TRUE)/2), 0, 1.1, 1//TRUE // TEST FOR SCALABLE TEXT //
ENDIF
IF mn > 260
PLAYMUSIC "hola.mp3", TRUE
X_MAKE2D // TEST FOR SCALABLE TEXT //

btw, i understand some things from you, but everything is different with this picture:
<HTML><BASIC><EC>
Be free and do good things

matchy

Code (glbasic) Select

// Bouncing 3D scaled text sample
WHILE TRUE
X_MAKE3D 0.001, 100.0, 45.0
X_CAMERA 1.0, 1.0, -10.0, 0.0, 0.0, 0.0
X_PRINT "PRESENTS...", 0.0, 0.0, 10.0, ABS(SIN(GETTIMERALL() / 10)) * 0.1
SHOWSCREEN
WEND

:rtfm: Tip: Set the X_PRINT scale# to a fraction and keep the X_CAMERA3D znear# low!