I have a problem with my character... when he hits the border that is set up... he doesn't go through but he still walks... how can I set it so that he becomes idle unless he moves away from the wall or along it?
rem **************************
rem ** DEMO **
rem ** Created By: **
rem ** Martin vanPutten **
rem **************************
rem ******************************************************************
rem * # Variables
rem ******************************************************************
rem * player = Player.
rem * PushEnterToBegin = Creates A Wait Period Until ENTER Is Pushed.
rem * playerY = Players Y Value.
rem * x = X Value.
rem * z = Z Value.
rem * cameraX = Cameras X Value.
rem * cameraZ = Cameras Z Value.
rem ******************************************************************
rem ******************************************************************
rem * $ Variables
rem ******************************************************************
rem * player = Your Characters Name.
rem ******************************************************************
rem Setup Introduction.
hide mouse
rem Start Introduction.
cls
center text screen width() / 2, screen height() / 2 - 20, "DEMO"
sleep 1000
center text screen width() / 2, screen height() / 2, "Created By: Martin vanPutten"
sleep 1000
center text screen width() / 2, screen height() / 2 + 20, "Loading"
sleep 5000
cls
center text screen width() / 2, screen height() / 2 - 10, "What is your name?"
set cursor screen width() / 2 - 115, screen height() / 2 + 100
print "..."
set cursor screen width() / 2 - 100, screen height() / 2 + 100
input player$
cls
set cursor screen width() / 2 - 150, screen height() / 2 - 100
print "Welcome to DEMO " ;player$; "!"
set cursor screen width() / 2 - 150, screen height() / 2 - 80
print "This is a brief example of what"
set cursor screen width() / 2 - 150, screen height() / 2 - 60
print "DarkBASIC is capable of. Feel"
set cursor screen width() / 2 - 150, screen height() / 2 - 40
print "free to interact with the objects."
set cursor screen width() / 2 - 150, screen height() / 2 - 20
center text screen width() / 2, screen height() / 2 + 50, "~~Push ENTER To Begin~~"
input PushEnterToBegin#
rem Setup Environment.
show mouse
autocam off
sync on
rem Prepare Ground For The Matrix.
Load bitmap "Ground.bmp", 1
Get Image 1, 1, 1, 128, 128
Delete Bitmap 1
rem Create Ground.
Make Matrix 1, 10000, 10000, 15, 15
Prepare Matrix Texture 1, 1, 1, 1
rem Load Charecter.
load object "idle.x", 1 : append object "walk.x", 1, 100
yrotate object 1, 180 : fix object pivot 1
position object 1, 10000, 5000, 10000
loop object 1, 0, 20 : set object speed 1, 5
rem Game Loop.
do
rem Status Bar
ink rgb((0), (0), (0)), 1
box 0, screen height() - 60, screen width() - 1, screen height() - 1
ink rgb((255), (255), (255)), 1
center text screen width() / 2, screen height() - 30, "Press the Escape Key to quit."
ink rgb(rnd(255), rnd(255), rnd(255)), 1
center text screen width() / 2, screen height() - 50, "This is the Status Bar for further Development."
rem Variables.
playerY# = Object angle Y(1)
rem Player Movement.
stage = 0
if Leftkey() = 1 then player# = player# - 9.0 : player# = wrapvalue(playerY# - 4.5)
if Rightkey() = 1 then player# = player# + 9.0 : player# = wrapvalue(playerY# + 4.5)
if Upkey() = 1 then x# = newxvalue(x#, player#, +12) : z# = newzvalue(z#, player#, +12) : stage = 1
if Downkey() = 1 then x# = newxvalue(x#, player#, -12) : z# = newzvalue(z#, player#, -12) : stage = 1
rem Boundaries.
if x# < -5000 then x# = -5000
if x# > 5000 then x# = 5000
if z# < -5000 then z# = -5000
if z# > 5000 then z# = 5000
rem Player Position.
position object 1, x# + 5000, 0.0, z# + 5000
yrotate object 1, player#
rem Controling Player Animation.
if stage <> oldstage
if stage = 0
set object frame 1, 0.0
loop object 1, 0, 20
set object speed 1, 10
endif
if stage = 1
set object frame 1, 105.0
loop object 1, 105, 125
set object speed 1, 40
endif
oldstage = stage
endif
rem Camera Control.
cameraZ# = newzvalue(z# + 5000, playerY# - 180, 300)
cameraX# = newxvalue(x# + 5000, playerY# - 180, 300)
Position Camera cameraX#, 150, cameraZ#
Point camera x# + 5000, 150, z# + 5000
rem Refresh Screen.
sync
rem End Game Loop.
loop
Live And Let Learn