Well i was able to make this work now i need to know one more thing lol, I'm running a test of skill by making a simple Horror game, I'm trying to create a flashlight right? i got the flashlight control to work the light turns on and off like a real flashlight would, but now it seems like the Light that is supposed to be illuminating while the Flashlight moves but the actual light is fixed in one position and doesn't move with the Flashlight like i want it to not only that but, the light only seems to be illuminating one side. Can someone help? heres my code.
` The Unseen
` Created by Firos12 and Mupo
` Version 1.0(Beta)
` This game puts the player in a world of dark spooky mystery.
` The player is required to search haunted areas and document any information,
` on these different places and find out what happened there.
` Start by setting up the screen resolution
Set Display Mode 1024, 768, 32
` Start the Sync rate
Sync On
Sync Rate 60
` Setup the other basics
Autocam Off
Hide Mouse
Backdrop On
Color Backdrop 0
` Load our texture and some sound
Load Image "Textures/grass08.bmp", 1
Load Sound "Sounds/crickets.wav", 1
Load Sound "Sounds/pick.wav", 2
Load Sound "Sounds/Noooo.wav", 3
Play Sound 1
Loop Sound 1
Set Sound Volume 1, 100
Set Sound Volume 3, 100
Set EAX 3
` Load a Flashlight
Make Object Cylinder 1, 2
XRotate Object 1, 90
Fix Object Pivot 1
Scale Object 1, 100, 100, 300
Position Object 1, 7, -7, 12
Lock Object On 1
Hide Object 1
` Make a cube
Make Object Cube 2, 10
Position Object 2, 5000, 90, 5000
Scale Object 2, 1000, 1000, 1000
Fade Object 2, 1000
` Create a Landscape
Make Matrix 1, 10000, 10000, 32, 32
Prepare Matrix Texture 1, 1, 1, 1
Fill Matrix 1, 0, 1
X# = 5000
Z# = 5000
Randomize Matrix 1, 125.0
` Make a Light for flashlight illumination
Make Light 1
Set Directional Light 1, 7, -7, 1
Set Light To Object Position 1, 1
Set Light To Object Orientation 1, 1
Color Light 1, 128, 128, 128
Set Light Range 1, 2000
Hide Light 1
` Start the game loop
Do
` Prepare some Lights
Set Ambient Light 5
Fog On
Fog Color 0
Fog Distance 500
` Create a Listener
Position Listener 5000, 90, 5000
Position Sound 3, 5000, 90, 5000
` Get camera info
Set Cursor 0, 0
Print "Camera Data"
Print "-----------"
Print "Camera X Position = " ;Camera Position X()
Print "Camera Y Position = " ;Camera Position Y()
Print "Camera Z Position = " ;Camera Position Z()
Print "Camera X Rotation = " ;Camera Angle X()
Print "Camera Y Rotation = " ;Camera Angle Y()
Print "Camera Z Rotation = " ;Camera Angle Z()
` Store the camera angle
OldcaY# = caY#
OldcaX# = caX#
caY# = Wrapvalue(caY# + MouseMoveX() * 0.5)
caX# = Wrapvalue(caX# + MouseMoveY() * 0.5)
` Show the Flashlight if the Shift Key is pressed
` Hide the Flashlight if the Control key Is pressed
Flashlight = 0
If ShiftKey() = 1 And Flashlight = 0
Show Light 1
Show Object 1
Endif
If ControlKey() = 1
Hide Light 1
Hide Object 1
Endif
` Play a custom sound when the camera reaches this position
If Camera Position X() = 5000 And Camera Position Z() = 5000
Play Sound 3
Endif
` Control input for Player
If UpKey() = 1
XTest# = NewXValue(X#, caY#, 10)
ZTest# = NewZvalue(Z#, caY#, 10)
If XTest# > 0 And XTest# < 10000 And ZTest# > 0 And ZTest# < 10000
X# = XTest#
Z# = ZTest#
Endif
Endif
If DownKey() = 1
XTest# = NewXValue(X#, Wrapvalue(caY# - 180), 10)
ZTest# = NewZValue(Z#, Wrapvalue(caY# - 180), 10)
If XTest# > 0 And XTest# < 10000 And ZTest# > 0 And ZTest# < 10000
X# = XTest#
Z# = ZTest#
Endif
Endif
If LeftKey() = 1
XTest# = NewXValue(X#, Wrapvalue(caY# - 90), 10)
ZTest# = NewZValue(Z#, Wrapvalue(caY# - 90), 10)
IF XTest# > 0 And XTest# < 10000 And ZTest# > 0 And ZTest# < 10000
X# = XTest#
Z# = ZTest#
Endif
Endif
If RightKey() = 1
XTest# = NewXValue(X#, Wrapvalue(caY# + 90), 10)
ZTest# = NewZValue(Z#, Wrapvalue(caY# + 90), 10)
IF XTest# > 0 And XTest# < 10000 And ZTest# > 0 And ZTest# < 10000
X# = XTest#
Z# = ZTest#
Endif
Endif
If caX# > 270
If caX# - 270 > 90 Then caX# = 270
Else
If caX# > 90 And caX# - 270 < 270 Then caX# = 90
Endif
YRotate Camera CurveAngle(caY#, OldcaY#, 24)
XRotate Camera CurveAngle(caX#, OldcaX#, 24)
Y# = Get Ground Height(1, X#, Z#)
Position Camera X#, Y# + 50, Z#
` Update the screen
Sync
Loop
As you can see here:
` Make a Light for flashlight illumination
Make Light 1
Set Directional Light 1, 7, -7, 1
Set Light To Object Position 1, 1
Set Light To Object Orientation 1, 1
Color Light 1, 128, 128, 128
Set Light Range 1, 2000
Hide Light 1
I tried using the commands that are supposed to link the light with the flashlight but it doesn't seem to work. You guys can go ahead and test what I'm talking about lol, just back up while your playing and you will see the cube. I Have attached the one sound that i made by myself with my voice.