`for sparkys to work, you need to sets of positions.
`the position before and after movements, called oldx#... and x#....
oldx#=object position x(152)
oldy#=object position y(152)
oldz#=object position z(152)
angle#=object angle y(152)
set camera to follow oldx#,oldy#,oldz#,angle#,30,20,40,0
IF UPKEY()=1 THEN MOVE OBJECT 152,.5
IF DOWNKEY()=1 THEN MOVE OBJECT 152,-.5
IF LEFTKEY()=1 THEN move OBJECT LEFT 152,.7
IF RIGHTKEY()=1 THEN move OBJECT RIGHT 152,.7
`-3 is "gravity"
x#=object position x(152)
y#=object position y(152)-3
z#=object position z(152)
`check for collision between the two different positions.
position object 152, x#,y#,z#
collision = sc_raycastgroup(1,oldx#,oldy#+10,oldz#,x#,y#-10,z#,0)
`if a collision, then you are on a block, so position back on top of that block
`if not, youll just keep falling
if collision > 1
y# = y#+3
position object 152,x#,y#,z#
endif
I think the problem is with that section.
Try this code instead.
Set Display Mode 1024, 768, 32
Sync On
Sync Rate 60
Color Backdrop RGB(64,0,128)
Backdrop On
autocam off
`Set Window Title "Jaskarans game"
show mouse
position camera 0,20,-20
point camera 0,0,0
rem
FOR a =2 to 151
MAKE OBJECT CUBE a,5
NEXT a
make object sphere 152,3
make object cube 1,1.5
color object 1, rgb(255,0,255)
make object cube 200,1.5
color object 200, rgb(0,255,0)
make object cube 201,1.5
color object 201,RGB(225,168,46)
make object cube 202,1.5
color object 202,RGB(0,0,255)
make object cube 203,1.5
color object 203,RGB(255,255,0)
position object 2,0,0,4
position object 3,0,0,8
position object 4,4,0,0
position object 5,0,4,0
position object 6,8,0,0
position object 7,12,0,0
position object 8,0,0,12
position object 9,0,0,16
position object 10,0,0,20
position object 11,16,0,0
position object 12,20,0,0
position object 13,24,0,0
position object 14,28,0,0
position object 15,32,0,0
position object 16,36,0,0
position object 17,40,0,0
position object 18,44,0,0
position object 19,48,0,0
position object 20,52,0,0
position object 21,56,0,0
position object 22,60,0,0
position object 23,64,0,0
position object 24,0,0,20
position object 25,0,0,24
position object 26,0,0,28
position object 27,0,0,32
position object 28,0,0,36
position object 29,0,0,40
position object 30,0,0,44
position object 31,0,0,48
position object 32,0,0,52
position object 33,0,0,56
position object 34,0,0,60
position object 35,4,0,60
position object 36,8,0,60
position object 37,12,0,60
position object 38,16,0,60
position object 39,20,0,60
position object 40,24,0,60
position object 41,28,0,60
position object 42,32,0,60
position object 43,36,0,60
position object 44,40,0,60
position object 45,44,0,60
position object 46,48,0,60
position object 47,52,0,60
position object 48,56,0,60
position object 49,60,0,60
position object 50,64,0,60
position object 51,64,0,4
position object 52,64,0,8
position object 53,64,0,12
position object 54,64,0,16
position object 55,64,0,20
position object 56,64,0,24
position object 57,64,0,28
position object 58,64,0,32
position object 59,64,0,36
position object 60,64,0,40
position object 61,64,0,44
position object 62,64,0,48
position object 63,64,0,52
position object 64,64,0,56
position object 65,64,0,60
position object 66,4,0,16
position object 67,8,0,16
position object 68,12,0,16
position object 69,12,0,20
position object 70,16,0,20
position object 71,20,0,20
position object 72,20,0,4
position object 73,20,0,8
position object 74,20,0,12
position object 75,20,0,16
position object 76,20,0,24
position object 77,20,0,28
position object 78,4,0,40
position object 79,8,0,40
position object 80,8,0,44
position object 81,12,0,44
position object 82,16,0,44
position object 83,20,0,44
position object 84,36,0,56
position object 85,36,0,52
position object 86,36,0,48
position object 87,40,0,48
position object 88,40,0,44
position object 89,40,0,40
position object 90,60,0,36
position object 91,56,0,36
position object 92,56,0,32
position object 93,52,0,32
position object 94,48,0,32
position object 95,60,0,16
position object 96,56,0,16
position object 97,56,0,12
position object 98,52,0,12
position object 99,48,0,12
position object 100,44,0,4
position object 101,44,0,8
position object 102,44,0,12
position object 103,44,0,16
position object 104,44,0,20
position object 105,44,0,24
position object 106,44,0,28
position object 107,44,0,32
position object 108,44,0,36
position object 109,40,0,4
position object 110,40,0,8
position object 111,40,0,12
position object 112,40,0,16
position object 113,40,0,20
position object 114,40,0,24
position object 115,40,0,28
position object 116,40,0,32
position object 117,36,0,4
position object 118,36,0,8
position object 119,36,0,12
position object 120,36,0,16
position object 121,36,0,20
position object 122,36,0,24
position object 123,36,0,28
position object 124,36,0,32
position object 125,36,0,36
position object 126,36,0,40
position object 127,36,0,44
position object 128,32,0,4
position object 129,32,0,8
position object 130,32,0,12
position object 131,32,0,16
position object 132,32,0,20
position object 133,32,0,24
position object 134,32,0,28
position object 135,32,0,32
position object 136,32,0,36
position object 137,32,0,40
position object 138,32,0,44
position object 139,28,0,4
position object 140,28,0,8
position object 141,28,0,12
position object 142,28,0,16
position object 143,28,0,20
position object 144,28,0,24
position object 145,28,0,28
position object 146,28,0,32
position object 147,28,0,36
position object 148,28,0,40
position object 149,28,0,44
position object 150,24,0,44
position object 151,24,0,28
position object 152,4,4,0
position object 1,12,4,-3
position object 200,16,4,-3
color object 152, RGB(255,0,0)
position object 201,20,4,-3
position object 202,20,4,4
position object 203,20,4,8
load image "lichen.bmp",3
texture object 1,3
texture object 2,3
texture object 7,3
load image "ha2.jpg",7
texture object 5,7
load image "gate.jpg",8
texture object 3,8
texture object 6,8
texture object 4,3
texture object 8,3
texture object 9,8
texture object 10,3
texture object 11,8
texture object 12,3
texture object 13,8
texture object 14,3
texture object 15,8
texture object 16,3
texture object 17,8
texture object 18,3
texture object 19,8
texture object 20,3
texture object 21,8
texture object 22,3
texture object 23,8
texture object 24,3
texture object 25,8
texture object 26,3
texture object 27,8
texture object 28,3
texture object 29,8
texture object 30,3
texture object 31,8
texture object 32,3
texture object 33,8
texture object 34,3
texture object 35,8
texture object 36,3
texture object 37,8
texture object 38,3
texture object 39,8
texture object 40,3
texture object 41,8
texture object 42,3
texture object 43,8
texture object 44,3
texture object 45,8
texture object 46,3
texture object 47,8
texture object 48,3
texture object 49,8
texture object 50,3
texture object 51,3
texture object 52,8
texture object 53,3
texture object 54,8
texture object 55,3
texture object 56,8
texture object 57,3
texture object 58,8
texture object 59,3
texture object 60,8
texture object 61,3
texture object 62,8
texture object 63,3
texture object 64,8
texture object 65,3
texture object 66,3
texture object 67,8
texture object 68,3
texture object 69,8
texture object 70,3
texture object 71,8
texture object 72,8
texture object 73,3
texture object 74,8
texture object 75,3
texture object 76,3
texture object 77,8
texture object 78,3
texture object 79,8
texture object 80,3
texture object 81,8
texture object 82,3
texture object 83,8
texture object 84,3
texture object 85,8
texture object 86,3
texture object 87,8
texture object 88,3
texture object 89,8
texture object 90,8
texture object 91,3
texture object 92,8
texture object 93,3
texture object 94,8
texture object 95,3
texture object 96,8
texture object 97,3
texture object 98,8
texture object 99,3
texture object 100,8
texture object 101,3
texture object 102,8
texture object 103,3
texture object 104,8
texture object 105,3
texture object 106,8
texture object 107,3
texture object 108,8
texture object 109,3
texture object 110,8
texture object 111,3
texture object 112,8
texture object 113,3
texture object 114,8
texture object 115,3
texture object 116,8
texture object 117,8
texture object 118,3
texture object 119,8
texture object 120,3
texture object 121,8
texture object 122,3
texture object 123,8
texture object 124,3
texture object 125,8
texture object 126,3
texture object 127,8
texture object 128,3
texture object 129,8
texture object 130,3
texture object 131,8
texture object 132,3
texture object 133,8
texture object 134,3
texture object 135,8
texture object 136,3
texture object 137,8
texture object 138,3
texture object 139,8
texture object 140,3
texture object 141,8
texture object 142,3
texture object 143,8
texture object 144,3
texture object 145,8
texture object 146,3
texture object 147,8
texture object 148,3
texture object 149,8
texture object 150,3
texture object 151,3
`setup the boxes for collision
for obj = 1 to 151
sc_setupobject obj,1,2
next
`setup player for collision
sc_setupobject 152,2,1
for b= 2 to 151
automatic object collision b,1,1
next b
ode set contact fdir1 152,100
load music "music.wav",207
loop music 207
make light 1
color light 1,RGB(0,255,0)
position light 1,4,8,20
set light range 1,20
mysound=200
load sound "yummy.wav",200
do
if spacekey()=1 and jump=0
jump = 1
jumpstart# = object position y(152)
jumpheight# = 5.0
endif
if jump > 0
if object position y(152) < jumpstart# + jumpheight# and jump = 1
position object 152, object position x(152),object position y(152)+0.2,object position z(152)
else
jump = 2
position object 152, object position x(152),object position y(152)-0.2,object position z(152)
endif
if jump = 2 and object position y(152) <= jumpstart# then jump = 0
endif
if object collision (152,200)=1
hide object 200
play sound mysound
endif
if object collision (152,201)=1
hide object 201
play sound mysound
endif
if object collision (152,202)=1
hide object 202
play sound mysound
endif
if object collision (152,203)=1
hide object 203
play sound mysound
endif
IF UPKEY()=1 THEN MOVE OBJECT 152,.5
IF DOWNKEY()=1 THEN MOVE OBJECT 152,-.5
IF LEFTKEY()=1 THEN move OBJECT LEFT 152,.7
IF RIGHTKEY()=1 THEN move OBJECT RIGHT 152,.7
`for sparkys to work, you need to sets of positions.
`the position before and after movements, called oldx#... and x#....
oldx#=object position x(152)
oldy#=object position y(152)
oldz#=object position z(152)
angle#=object angle y(152)
set camera to follow oldx#,oldy#,oldz#,angle#,30,20,40,0
`-3 is "gravity"
x#=object position x(152)
y#=object position y(152)-5
z#=object position z(152)
`check for collision between the two different positions.
collision = sc_raycastgroup(1,oldx#,oldy#,oldz#,x#,y#,z#,0)
`if a collision, then you are on a block, so position back on top of that block
`if not, youll just keep falling
if collision > 1
position object 152,x#,y#,z#
else
position object 152,x#,y#+5,z#
endif
YROTATE OBJECT 1,OBJECT ANGLE Y(1)+1
YROTATE OBJECT 200,OBJECT ANGLE Y(200)+1
YROTATE OBJECT 201,OBJECT ANGLE Y(201)+1
YROTATE OBJECT 202,OBJECT ANGLE Y(202)+1
YROTATE OBJECT 203,OBJECT ANGLE Y(203)+1
sync
loop
`you just need to put this add the end for sparkys to work.
delete memblock 1