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.

Code Snippets / [LOCKED] what is wrong with this?

Author
Message
evil creation
20
Years of Service
User Offline
Joined: 9th Jun 2004
Location:
Posted: 22nd Jun 2004 15:50
menu:

gosub menuf

gosub delete

gosub setup

newblock()

do

gosub usercontrol

gosub variables

gosub ai

gosub wrap

gosub position

gosub collision

gosub lose

gosub camera

gosub arrow

text 0,0,"You have " + str$(score) + " points."

point object 2,x#,object position y(2),z#

sync

loop

`**********************FUNCTIONS/GOSUBS****************
`*******NEW*BLOCK*******
function newblock()
make object cube 3,10
r1 = rnd(1000)
r2 = rnd(1000)
position object 3,r1,get ground height(1,r1,r2),r2
set object collision to boxes 3
color object 3,rgb(255,100,175)
endfunction

`*****USER*CONTROL*******
usercontrol:
if upkey()=1 then move object 1,5
if downkey()=1 then move object 1,-5
if rightkey()=1 then yrotate object 1,wrapvalue(ay#+3)
if leftkey()=1 then yrotate object 1,wrapvalue(ay#-3)
return

`******SETUP*******
setup:

sync on
autocam off
hide mouse

load image "moss03.bmp",1
load object "arrow.x",6

scale object 6,500,500,500
yrotate object 6,270
position object 6,7,0,0

load object "player.x",1
load object "enemy.x",2
scale object 1,450,450,450
scale object 2,450,450,375
yrotate object 1,180
yrotate object 2,180

position object 1,0,0,0
position object 2,1000,0,1000

set object collision to boxes 1
set object collision to spheres 2

make matrix 1,1000,1000,10,10
randomize matrix 1,50
prepare matrix texture 1,1,1,1

lose = 0
score = 0
ypress = 0

fog on
fog color 0
fog distance 500
color backdrop 0
return

`*******MENU******
menuf:
ink rgb(255,255,255),0
print "1) Instructions"
print "2) Play Game"
print "3) Exit"
input "Enter Number ",choice

if choice = 1
print "You must pick up the pink containers before the cops get you."
print "Use the arrow keys to move and follow the arrow to the ext canister."
goto menu:
endif

if choice = 3 then end
return

`*******VARIABLES******
variables:
ay# = object angle y(1)
x# = object position x(1)
z# = object position z(1)
x2# = object position x(2)
z2# = object position z(2)
return

`********ARTIFICIAL*INTELLIGENCE****
ai:
if x2# > x# then x2# = x2# - 3.5
if x2# < x# then x2# = x2# + 3.5
if z2# > z# then z2# = z2# - 3.5
if z2# < z# then z2# = z2# + 3.5
return

`*******WRAPVALUES****
wrap:
if x# > 1000 then x# = 1
if x# < 0 then x# = 999
if z# > 1000 then z# = 1
if z# < 0 then z# = 999
return

`*******POSITION*OBJECTS********
position:
position object 2,x2#,get ground height(1,x2#,z2#),z2#
position object 1,x#,get ground height(1,x#,z#),z#
return

`*********OBJECT*COLLISION*******
collision:
if object collision(1,0) = 3 and lose = 0 then score = score + 1 ; delete object 3 ; newblock()
if object collision(2,0) = 1 then lose = 1
return

`**********LOSE*CHECK*********
lose:
if lose = 1 then center text 320,220,"YOU LOSE - GAME OVER"
if lose = 1 then center text 320,260,"PRESS SPACE TO CONTINUE"
if lose = 1 and spacekey() = 1 then backdrop off ; cls ; goto menu
return

`**********CAMERA*POSITION******
camera:
position camera x#,0,z#
set camera to object orientation 1
move camera -50
position camera camera position x(),get ground height(1,camera position x(),camera position z())+10,camera position z()
return

`*******ARROW*POSITION*****
arrow:
position object 6,x#,get ground height(1,x#,z#),z#
set object to object orientation 6,1
move object 6,10
arx# = object position x(6)
arz# = object position z(6)
ary# = get ground height(1,arx#,arz#)
position object 6,arx#,ary#+20,arz#
point object 6,object position x(3),object position y(3),object position z(3)
return

`*********DELETE*STUFF*****
delete:
backdrop on
draw to front

for u = 1 to 100
if object exist(u)=1 then delete object u
next u

if matrix exist(1) then delete matrix 1
return

what i wrong with this?

the evil creation
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jun 2004 19:50
no idea, but this is the wrong board.

"eureka" - Archimedes
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 24th Jun 2004 07:45 Edited at: 24th Jun 2004 07:54
Hey! Thats my code! I programmed that for a game called Fox and Hounds 3D! It was originally called Car Run.

Dude, this is the code for it.



You can see my post here: http://darkbasic.thegamecreators.com/?m=forum_view&t=26199&b=6

A current version can be downloaded from my site at http://www.digitalraingames.wordfantastic.com

Grrr... (unless of course you've modified it to experiment...)

This is your post, incase you decide to edit it...


"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jun 2004 10:33
What's wrong with this? The fact that you didn't read the post at the top of this board titled 'No Questions Here, Snippets only'

Please take it to one of the other boards

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-11-23 19:36:18
Your offset time is: 2024-11-23 19:36:18