i'm trying to create a game-like-thing, and i don't know how to make it work. it keeps popping up "Program Has Ended".
thanks for any help,
-me
Couple of tips for posting on forums:
1. Try to make the subject more descriptive than "help!".
2. "I don't know how to make it work" isn't a very clear description of the problem.
3. It always helps if you post some code that demonstrates the problem.
:)
probably you must add the waitkey() loop
it is probably finishing and you must add
that so you press a key to quit the game
otherwise it quits before you see it ...
Could you please post some code so we can help you? It's alot easier seeing whats happening :o)
At the end of the program you should have:
End
This gets rid of that statement, when it finishes.
Check out the examples for how to make a proper program loop.
While Not KeyDown( 1 ) ;escape key pressed
;your code goes here.
;....
;....
wend
End
Graphics3D 640,480,16
SetBuffer BackBuffer()
sphere=CreateSphere()
EntityShininess sphere,.5
ScaleEntity nod,30,30,30
EntityColor nod,255,2,1
sphere2=CreateSphere()
EntityShininess sphere2,.5
ScaleEntity sphere2,30,30,30
EntityColor sphere2,22,255,1
MoveEntity sphere2,1,1,1
camera=CreateCamera()
PositionEntity camera,0,50,-46
TurnEntity camera,45,0,0
light=CreateLight()
TurnEntity light,45,45,0
RenderWorld
Repeat Forever
End
here's the code, you can all fiddle with it.
-me
try this:
Graphics3D 640,480,16,2
SetBuffer BackBuffer()
sphere=CreateSphere()
EntityShininess sphere,.5
ScaleEntity sphere,30,30,30
EntityColor sphere,255,2,1
sphere2=CreateSphere()
EntityShininess sphere2,.5
ScaleEntity sphere2,30,30,30
EntityColor sphere2,22,255,1
MoveEntity sphere2,1,1,1
camera=CreateCamera()
PositionEntity camera,0,50,-46
TurnEntity camera,45,0,0
light=CreateLight()
TurnEntity light,45,45,0
While Not KeyDown(1)
RenderWorld
Flip
Wend
End
What had happened is you had used the Repeat command with no 'Until', so the program did not repeat anything and went on to the End at the end.
Perturbatio's While/Wend loop
While Not KeyDown(1)
RenderWorld
Flip
Wend
is preferable to Repeat/Until, and will repeat until key (1) - which is escape- is pressed
This repeatedly renders the 3D world, and flips the display from the back buffer (where all 3D stuff is 'drawn' onto the front buffer (on screen).
You need renderworld inside the loop, and remember to flip the buffers once you have rendered,
Do your movement before renderworld.
Try to set up a loop as a template that you will use all the time, saves a wee bit of time. The one i use most, if not all of the time is
Graphics3d 800,600
setbuffer backbuffer()
camera=createcamera()
while not keyhit(1)
UpdateWorld
RenderWorld
Flip
Wend
End