Well, I have a script testing various things, like gravity, collision, movement, etc.
All has gone well, until I decided to try to make a bullet.
Well, I tried to do a laser script. I get an error saying something like "Error: Object does not exist at line #".(Forgot line number)
Here is my game script (Don't worry, it is short) (I added a bunch of comments, so it doesn't confuse newbies):
SYNC ON:SYNC RATE 0:AUTOCAM OFF
`Player object
MAKE OBJECT SPHERE 1, 10
Color Object 1, RGB(255, 255, 0)
SET OBJECT COLLISION ON 1
`I cant see without this
MAKE MATRIX 1,1000,1000,10,10
POSITION MATRIX 1,-500,0,-500
`yawn
MAKE OBJECT BOX 2,100,20,10
POSITION OBJECT 2,0,-25,50 ; Color Object 2, RGB(255, 100, 50)
SET OBJECT COLLISION ON 2
`this is getting tiring
MAKE OBJECT BOX 6,100,2,300
POSITION OBJECT 6,0,-25,0
Color Object 6, RGB(255, 100, 100)
SET OBJECT COLLISION ON 6
`is there an end?
MAKE OBJECT BOX 7,30000,2,30000
POSITION OBJECT 7,0,-200,0
Color Object 7, RGB(0, 0, 0)
Set object transparency 1, 100
SET OBJECT COLLISION ON 6
`DANG OBJECTS!
MAKE OBJECT SPHERE 3, 10
Color object 3, RGB(255, 0, 0)
Position object 3, -25, 100, 15
`Surely we can use one of these objects?
MAKE OBJECT SPHERE 4, 10
Color object 4, RGB(255, 0, 0)
Position object 4, -25, 100, 15
`I just put in a bunch of boxes, and they don't ever appear on the screen
MAKE OBJECT SPHERE 5, 10
Color object 5, RGB(255, 0, 0)
Position object 5, -25, 100, 15
`Apperently, this should be don't.
DO
If falling#=0 then move object 3, 0.3
If falling#=0 then Point object 3, ox#, oy#, oz#
falling#=1
`Woot! Crappy laser test script! Remove this, and the game works!
lasertest#=9000+1
if controlkey()=1
make object sphere lasertest#, 2
color object lasertest#, RGB(0, 255, 0)
move object lasertest#, 5
endif
`To make the game work, again, delete all inbetween this message and the last.
`Very usefull
ox# = OBJECT POSITION X(1)
oy# = OBJECT POSITION Y(1)
oz# = OBJECT POSITION Z(1)
`Camera junk
POSITION CAMERA ox#+10,oy#+20,oz#+5
POINT CAMERA ox#, oy#, oz#
MOVE CAMERA -50
`Movement junk
if upkey()=1 then move object 1, 0.05
if rightkey()=1 then turn object right 1, 0.5
if leftkey()=1 then turn object left 1, 0.5
`Super-simple-basic-easy-quick-lazy gravity
move object down 1, 0.098
move object down 3, 0
`Annoying collision
IF OBJECT COLLISION(1,2) THEN POSITION OBJECT 1, ox#,object position y(1),oz#
If object collision(1, 3) then move object 3, -0.1
If object collision(1, 7) then position object 1, 0, 0, 0
If object collision(1, 6) then POSITION OBJECT 1, object position x(1),oy#,object position z(1)
If object collision(3, 6) then move object up 3, 0.098
If object collision(3, 6) then falling#=0
`THE END IS NIGH!
`Told you so
SYNC
LOOP
I don't care if you rip any collision scripts or anything off of it. You have to take the laser code off for the game to work right.
This is my laser code (It is hard to miss, it is encased by two comments.
`Crappy laser test script. Remove it to make the game work!
lasertest#=9000+1
if controlkey()=1
make object sphere lasertest#, 2
color object lasertest#, RGB(0, 255, 0)
move object lasertest#, 5
endif
I want the lasers to be objects, so they are visible, and is then easier to add physical forces to.
Can anyone help me get this working?
The Person99 awards go to: 1. Jack the Ripper for hardest crime scenes. 2. Peter Petrelli for most powers. 3. Superman for longest flight. 4. "The Doctor" for best time travel machine.