Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 3d objects not showing, despite/to spite camera. Any advice appreciated.

Author
Message
Alexandre
14
Years of Service
User Offline
Joined: 7th Aug 2010
Location:
Posted: 7th Aug 2010 08:14
So I've started making a simplified 3D mario clone for world 1-1 just this morning, and already run into a problem I can't solve!

I've written and run 3d programs before, but this just isn't working. When I compile, I just get a black screen; I can't see my 3d objects?!. I've been searching the forums but haven't figured out a solution yet.

Thanks in advance, also please bear in mind I've just started using DBPro so my code may not be good for a multitude of reasons :S


remstart
PROJECT: Simple 2.5D Platformer Level
World 1-1 Mario
Date of Commencement: 8.7.2010
remend

`SETUP
SYNC ON
SYNC RATE 60
AUTOCAM OFF


`CONSTS
GLOBAL SCREEN_X AS FLOAT = 600.0
GLOBAL SCREEN_Y AS FLOAT = 600.0
`Screen Setup
SET WINDOW ON
SET WINDOW SIZE SCREEN_X, SCREEN_Y
SET DISPLAY MODE SCREEN_X, SCREEN_Y, 32

`CREATE USER DEFINED TYPES
`Type Vect2
TYPE Vect2
x AS FLOAT
y AS FLOAT
ENDTYPE

`Mario UDT
TYPE Player
Objnum AS INTEGER
Position AS Vect2
Speed AS FLOAT
Lives AS INTEGER
Score AS INTEGER
ENDTYPE

`Stationary Object UDT
TYPE Prop
ObjNum AS INTEGER
Position AS Vect2
ENDTYPE

`Movable UDT

`Pickup (3 of) UDT

`Enemy One (move) UDT

`Enemy Two (move and shoot) UDT

`GLOBAL VARIABLE DEFINITIONS
GLOBAL dt AS FLOAT

GLOBAL GndPlane AS Prop
GndPlane.ObjNum = 150
GndPlane.Position.x = 0
GndPlane.Position.y = 0

GLOBAL Mario AS PLAYER
Mario.Objnum = 151
Mario.Position.x = 0
Mario.Position.y = 0
Mario.Speed = 10.0
Mario.Lives = 3
Mario.Score = 0

`More GLOBALs here as I create more enitites

`GLOBAL DIM Pipes() AS Prop
`GLOBAL DIM Blocks() AS Prop

`OBJECT INITIALISATION
`LOAD OBJECT "ground_plane.x", GndPlane.Objnum
`POSITION OBJECT GndPlane.Objnum, 0, 0 , 0

MAKE OBJECT SPHERE Mario.Objnum, 15
COLOR OBJECT Mario.Objnum, RGB(255, 0, 0)
POSITION OBJECT Mario.Objnum, 0, 0, 0


`CAMERA INITIALISATION
MAKE CAMERA 1
POSITION CAMERA 1 , 0 , 0 , -100
POINT CAMERA 1, 0, 0, 0
`Backdrop Initialization
COLOR BACKDROP 1 , RGB( 0 , 0 , 0 )

` GAME LOOP
WHILE ESCAPEKEY() = 0
` Delta Time Update
IF SCREEN FPS() <> 0
dt = SCREEN FPS()
dt = 1.0 / dt
ELSE
dt = 0.016666
ENDIF

`Game Function calls LoadLevel() etc


`SET DOWN
SYNC
CLS
EXIT
ENDWHILE

`Write functions here later on

I'm looking for the true nature of things. But I'm not cynical at all. Or sarcastic for that matter. Now tell me: where is the irony here?
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 7th Aug 2010 14:47
Hi Alexandre, I believe the 'CLS' command at the end of you while loop is your problem, try commenting it out, as well as the 'EXIT' command otherwise your program runs and stops almost instantly.

A clever person solves a problem, a wise person avoids it - Albert Einstein
Alexandre
14
Years of Service
User Offline
Joined: 7th Aug 2010
Location:
Posted: 8th Aug 2010 03:11
It's always the little things haha

Thank you so much! I can once again move on with my code

I'm looking for the true nature of things. But I'm not cynical at all. Or sarcastic for that matter. Now tell me: where is the irony here?
Alexandre
14
Years of Service
User Offline
Joined: 7th Aug 2010
Location:
Posted: 8th Aug 2010 12:44
That did it Now I'm onto sparky's collision...we'll see how that goes. I'm enjoying it so far

I'm looking for the true nature of things. But I'm not cynical at all. Or sarcastic for that matter. Now tell me: where is the irony here?

Login to post a reply

Server time is: 2024-11-16 15:49:33
Your offset time is: 2024-11-16 15:49:33