Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-22-2005, 09:25 PM   #1 (permalink)
Freerefill
caffeine junky O.O
 
Freerefill's Avatar
 
Join Date: Jun 2005
Location: second star to the right, and straight on till morning
Posts: 1
Freerefill is on a distinguished road
Blitz3D

im in dire need of assistance. ive been stuck on this problem for 3 days now and ive gotten no work done because of it.

im a novice at using Blitzplus and Blitz3D, in fact i havent even coded a complete game yet (that wasnt a tutorial at least), but ive been hard at work trying new things, as any novice programmer would.

im trying to write a program thatll let me create an object with a number of characteristics using one function and then update their position with another function in the main loop. after a number of "Memory Access Violation"'s, i decided to debug it using a much simpler version of the program. in fact, i got rid of the second function entirely. here's my code:

Graphics3D 800,600
SetBuffer BackBuffer()
cam1 = CreateCamera()
PositionEntity cam1,0,0,-5

Function createobject()
sphere = CreateSphere()
End Function

createobject()

While Not KeyHit(1)
UpdateWorld
RenderWorld
TurnEntity name,0,1,0
Flip
Wend
End


this is the code that doesnt work. i believe the problem is that somehow the handle of the entity (sphere) doesnt stick with the entity after its created. so once the function is done, everything that was created exists, but the handle just disappears. whats the problem, and is there a solution?

many thanks in advance, this problem has been killing me for quite some time
Freerefill is offline   Reply With Quote
Old 08-15-2006, 01:31 PM   #2 (permalink)
kevin8084
Registered User
 
Join Date: Aug 2006
Posts: 3
kevin8084 is on a distinguished road
Quite late

Quite a bit late, but this will work:
Code:
Graphics3D 800,600
SetBuffer BackBuffer()

cam1 = CreateCamera()
PositionEntity cam1,0,0,-5

Global sphere

Function createobject()
     sphere=CreateSphere()
End Function

createobject()

While Not KeyHit(1)
     TurnEntity sphere,0,1,0
     UpdateWorld
     RenderWorld
     Flip
Wend
End
kevin8084 is offline   Reply With Quote
Old 08-24-2008, 06:45 AM   #3 (permalink)
Wolfman
Recruit
 
Wolfman's Avatar
 
Join Date: Aug 2008
Location: The Pillars of Nosgoth!
Posts: 3
Wolfman is on a distinguished road
Alternatively, you could use my method, which I find more functional...

Code:
Graphics3D 800,600
SetBuffer BackBuffer()
cam1 = CreateCamera()
PositionEntity cam1,0,0,-5

Function createobject()
sphere=CreateSphere()
Return sphere
End Function 

orb=createobject() 
While Not KeyHit(1) 
TurnEntity orb,0,1,0 
UpdateWorld 
RenderWorld 
Flip 
Wend 
End
Wolfman is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 03:18 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting