help!

Blitz3D Forums/Blitz3D Beginners Area/help!

patisawesome(Posted 2003) [#1]
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


GfK(Posted 2003) [#2]
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.

:)


patisawesome(Posted 2003) [#3]
okay.
-me


Caff(Posted 2003) [#4]
gimme da code


googlemesilly(Posted 2003) [#5]
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 ...


Ross C(Posted 2003) [#6]
Could you please post some code so we can help you? It's alot easier seeing whats happening :o)


AbbaRue(Posted 2003) [#7]
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


patisawesome(Posted 2003) [#8]
thanks!
-me


patisawesome(Posted 2003) [#9]
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


Perturbatio(Posted 2003) [#10]
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



_PJ_(Posted 2003) [#11]
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).


patisawesome(Posted 2003) [#12]
okay, thanks!
-me


Perturbatio(Posted 2003) [#13]
You need renderworld inside the loop, and remember to flip the buffers once you have rendered,

Do your movement before renderworld.


Ross C(Posted 2003) [#14]
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