I am working on two platformers. Both will end up being semi-Mario. The first one is a 3D take on "D (side scrolling). At the moment I have this coding:
Rem _________________________________
Rem |||||||||||||||||||||||||||||||||
Rem ||||| 3D platform mark 2 ||||||||
Rem |||||||||||||||||||||||||||||||||
Rem |||||||||||||||||||||||||||||||||
rem Standard Setup Code
sync on
sync rate 60
autocam off
hide mouse
rem textures
load image "brick07.bmp",1
rem character
LOAD OBJECT "idle.x",1 : APPEND OBJECT "walk.x",1,100
YROTATE OBJECT 1,180 : FIX OBJECT PIVOT 1
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,10
x#=0 : y#=0 : z#=0
position object 1, x#, y#, z#
rem Switch on collision for the object
set object collision on 1
rem scenery
rem base
make object box 2,50,50,5000
position object 2,0,-25,2275
texture object 2,1
make static object 2
rem wall 1
make object box 3,50,250,50
position object 3,0,125,-200
texture object 3,1
make static object 3
rem camera
camerax#=0
position camera 300, -50, 50
point camera object position x(1), object position y(1)+100, object position z(1)
do
gosub display
gosub collision
gosub Input_check
gosub camera
if jmp=1 then gosub Jump_run
if (init_pos + S#)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
return
rem camera commands
camera:
position camera 300, 0, object position z(1)+50
return
Jump_run:
rem jumping
if jmp=1 then inc time#, (1.0*step#)
S#=(12.0*time#)+(0.5)*(-0.6)*(time#^2.0)
position object 1, object position x(1), init_pos + S#, object position z(1)
return
end_jump:
jmp=0
time#=0.0
return
collision:
if object collision(1,3)>0
ink 0,rgb(255,255,255)
z#=oldz#
else
ink rgb(255,255,255),0
endif
return
When I run into the wall, the character stops. Unfortunately, he cannot get away - he can jump, but he is still stuck to it like a fly on flypaper. I don't know how to solve this (it is strange)
The other problem is my other 3D platformer (uses same basis but more like mario64).
Rem ***** Main Source File *****
rem Standard Setup Code
sync on : sync rate 60 : autocam off
color backdrop rgb(0,0,0) : hide mouse
set text font "arial" : set text size 18 : set text transparent
`set-up a few objects
rem character
LOAD OBJECT "idle.x",1 : APPEND OBJECT "walk.x",1,100
YROTATE OBJECT 1,180 : FIX OBJECT PIVOT 1
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,10
position object 1, 100, 0, 100
make object plain 2, 500, 500
xrotate object 2, 90
position object 2, 0, -16, 0
position camera 300, 300, 50
point camera 50, 50, 0
`main loop
do
gosub display
gosub Input_check
if jmp=1 then gosub Jump_run
if (init_pos + S#)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
return
Jump_run:
rem jumping
if jmp=1 then inc time#, (1.0*step#)
S#=(12.0*time#)+(0.5)*(-0.6)*(time#^2.0)
position object 1, object position x(1), init_pos + S#, object position z(1)
return
end_jump:
jmp=0
time#=0.0
return
It probably has a simple answer,but I can't find it. I don't know how to make the camera behind him and follow him round
O
x
|
|
|
The camera (O) should be roughly behind and above the character (marked by x and dashes). Unfortunately it can't following him. So I need help
Thanks
RED GENERAL
My computer melts regulary - perhaps it likes being fondue