Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / code won't close

Author
Message
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 6th Apr 2009 12:22 Edited at: 6th Apr 2009 14:37
sync on
sync rate 0
hide mouse
autocam off

make object sphere 1,50:color object 1,rgb (255,0,0): position object 1,0,0,0

load object "bath.3ds",3: position object 3,0,0,30:color object 3,rgb (47,47,47)
make object cube 4,20 : scale object 4,500,1,500 : position object 4,0,-10,0 : color object 4,rgb (3,255,2)
load object "sword.3ds",2
load image "cube1_au.bmp",1
texture object 2,1
fix object pivot 2
position object 2,0,-7,15
lock object on 2

EnemyHP#=2000` Enemy's Health
Ammo#=1000` Starting Ammo
MaxAmmo#=1000` Maximum amount of Ammo
Clips#=3` Starting Clips
MaxClips#=3` Maximum amount of Clips
JUMPING#=0
JUMP$="Jumping"
gravity#=0
gravity$="gravity"

MAKE OBJECT SPHERE 9999,10
MAKE MESH FROM OBJECT 1,9999
DELETE OBJECT 9999
ADD LIMB 1,1,1
OFFSET LIMB 1,1,0,0,500
HIDE LIMB 1,1

ADD LIMB 1,2,1
OFFSET LIMB 1,2,0,-50,0
DELETE MESH 1
HIDE LIMB 1,2

Do

IF KEYSTATE(1)=0 AND MOUSECLICK()=1
rotate object 2,90,0,0
wait 3000
rotate object 2,-90,0,0
endif


POSITION CAMERA OBJECT POSITION X(1),OBJECT POSITION Y(1),OBJECT POSITION Z(1)

If keystate(17)=1 then move object 1,.2
IF KEYSTATE(31)=1 THEN MOVE OBJECT 1,-.2
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,.1
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,.1

IF SPACEKEY()=1 AND JUMPING#=0 THEN JUMP#=1

IF JUMP#=1
GROUND#=OBJECT POSITION Y(1)
JUMP_SPEED#=0.5
JUMPING#=1
JUMP#=0
ENDIF

IF JUMPING#=1
DEC JUMP_SPEED#,.001
POSITION OBJECT 1,OBJECT POSITION X(1),OBJECT POSITION Y(1)+JUMP_SPEED#, OBJECT POSITION Z(1)
IF OBJECT POSITION Y(1)<=GROUND# THEN JUMPING#=0
ENDIF

CAMY#=CAMY#+MOUSEMOVEX()*.1
CAMX#=CAMX#+MOUSEMOVEY()*.1
IF CAMX#>90 AND CAMX#<135 THEN CAMX#=90
IF CAMX#>270 AND CAMX#<225 THEN CAMX#=90
YROTATE CAMERA CAMY#
XROTATE CAMERA CAMX#
YROTATE OBJECT 1,CAMY#
XROTATE OBJECT 1,CAMX#

sync
loop
it works now but i need help with the rotation

www.madninjas.co.nr we are mad and we are ninjas
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 6th Apr 2009 13:01
Why have you got an endif outside of your loop?

You should move the endif up above the loop command, and move Sync outside of the if statement so that your screen is updated regardless of whether the if loop is executed.

So the end of your code should look like:
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 6th Apr 2009 13:05
it still says could not close nest at line 86

www.madninjas.co.nr we are mad and we are ninjas
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 6th Apr 2009 14:20
need one more endif some were, four if's with only 3 endif's.

Dark Physics makes any hot drink go cold.
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 6th Apr 2009 14:21
I didn't have that problem, but I did get a problem with your limb commands.

Reorganising your code as follows works though:
mike5424
15
Years of Service
User Offline
Joined: 30th Mar 2009
Location:
Posted: 6th Apr 2009 14:36
ok... howdo i din't understand but bursar thx it worked now i have another problem when i click my sword rotates but it should go back to normall after 3 seconds but it dosent so anyone know what is wrong here

p.s. the code is now the one bursar posted

www.madninjas.co.nr we are mad and we are ninjas

Login to post a reply

Server time is: 2024-09-28 04:16:20
Your offset time is: 2024-09-28 04:16:20