Jump to content
IGNORED

Jumping Man


orion1052003

Recommended Posts

post-19460-0-87805700-1315698416_thumb.jpgI was trying to make a "running man" jump, either with a keypress or with CALL JOYST. Now, I have a running man that can move about on screen, one program with key input another with joystick. It was adapted from the Millers Sprites book, and there is another better key input jump version written by Jacques. Some games jump in an arc in the direction you are facing, I think a few just go straight up and back down, and some go up and you can influence the jump slightly left or right with the joystick. At least on arcade games.

 

The problem is, the jump is not nice and clean and seems to mess up on the way down. I was going more for a "Major Havoc" style jump that you hold the jump button down, rather than the mario jump where you tap it and he does a little jump. It has gotten so confusing between the 3 programs, key input for R,C and SPRITE locations DR,DC that it is hard to tell what's what anymore.

 

Here is the code if anyone has any suggestions or knowledge on this.

 

10 !JACQUES JUMP SUB

50 ! SAVE DSK1.JUMP

100 CALL CHAR(110,"9898FF197848C80C")

110 CALL CHAR(104,"18187E5A5A18183C")

120 CALL CHAR(107,"9898FF1918784FC1")

130 CALL CHAR(108,"1919FF98181EF283")

140 CALL CHAR(105,"1919FF981E121330")

150 CALL CHAR(117,"1919FF981E121330")

160 CALL CHAR(111,"18187E5A5A18183C")

170 CALL CHAR(114,"1858587F19382E62")

180 CALL CHAR(115,"18183C5F983C4466")

190 CALL CHAR(112,"9898FF197848C80C")

195 CALL CHAR(123,"00")

200 CALL CLEAR :: CALL COLOR(2,7,7) :: CALL SCREEN(11) :: CALL HCHAR(24,1,40,64)!:: CALL VCHAR(1,31,40,96)

210 R,C=10 :: DR,DC=73 :: CALL SPRITE(#1,42,2,DR,DC)

220 CALL KEY(1,K,S) :: IF(K>6 AND K<14)-(K=1 OR(K>15 AND K<18)OR K=19)THEN 220

230 Y=(K>3 AND K<7)-(K=0 OR K=15 OR K=14) :: X=(K=2 OR K=4 OR K=15)-(K=3 OR K=6 OR K=14) :: KK=K

240 IF K=18 THEN CALL JUMP(C,DR,DC)

250 CALL PAT(KK)

280 CALL GCHAR(R+Y,X+C,CH) :: IF CH=40 THEN CALL SOUND(-60,110,9) :: GOTO 220

285 C=C+X :: R=R+Y :: IF C<2 THEN C=30 ELSE IF C>30 THEN C=2

288 DR=R*8-7 :: DC=C*8-7

290 CALL LOCATE(#1,DR,DC)

300 GOTO 220

1000 SUB JUMP(C,DR,DC) :: SDR=DR

1010 CALL KEY(1,K,S) :: IF K=18 THEN DR=DR-4 :: DC=DC+1 :: IF DC>240 THEN DC=1

1020 IF DR<8 THEN 1040

1030 CALL LOCATE(#1,DR,DC) :: CALL PAT(KK) :: IF S<0 THEN 1010

1040 IF DR<SDR THEN DR=DR+4 :: DC=DC+1 :: CALL LOCATE(#1,DR,DC) :: IF DC>240 THEN DC=1

1050 CALL PAT(KK) :: IF DR<SDR THEN 1040

1060 C=INT((DC+7)/8) :: SUBEND

2000 SUB PAT(KK) :: CALL PATTERN(#1,KK+105)

2010 FOR I=1 TO 10 :: NEXT I

2020 CALL PATTERN(#1,KK+112)

2030 FOR I=1 TO 10 :: NEXT I

2090 SUBEND

 

-----------------------------------------------------------------------

KEYTEST

 

100 CALL CHAR(110,"9898FF197848C80C")

110 CALL CHAR(104,"18187E5A5A18183C")

120 CALL CHAR(107,"9898FF1918784FC1")

130 CALL CHAR(108,"1919FF98181EF283")

140 CALL CHAR(105,"1919FF981E121330")

150 CALL CHAR(117,"1919FF981E121330")

160 CALL CHAR(111,"18187E5A5A18183C")

170 CALL CHAR(114,"1858587F19382E62")

180 CALL CHAR(115,"18183C5F983C4466")

190 CALL CHAR(112,"9898FF197848C80C")

200 CALL CLEAR :: CALL COLOR(2,7,7) :: CALL SCREEN(11) :: CALL HCHAR(24,1,40,64) :: CALL VCHAR(1,31,40,96) :: CALL SPRITE(#1,42,2,153,33) :: R=20 :: C=5

210 CALL KEY(1,K,S) :: IF((K>6 AND K<14)OR K=18)-(K=1 OR(K>15 AND K<18)OR K=19)THEN 210

220 Y=(K>3 AND K<7)-(K=0 OR K=15 OR K=14) :: X=(K=2 OR K=4 OR K=15)-(K=3 OR K=6 OR K=14)

225 IF DR=1 THEN DR=DR-1 :: IF R=0 THEN R=R+1

230 DISPLAY AT(22,1):"KEY=";K+105

240 CALL PATTERN(#1,K+105)

250 FOR I=1 TO 10 :: NEXT I

260 !ISPLAY AT(23,1):"KEYB= ";K-104

270 CALL PATTERN(#1,K+112)

280 !ISPLAY AT(23,1):"KEYC= ";K-110

290 CALL GCHAR(R+Y,X+C,CH) :: IF CH=40 THEN CALL SOUND(-60,110,9) :: GOTO 210 ELSE C=C+X :: R=R+Y :: DR=R*8-7 :: DC=C*8-7

292 CALL LOCATE(#1,DR,DC)

295 CALL KEY(1,K,S) :: IF K=18 THEN CALL JUMP(C,DR,DC)

297 GOTO 210

300 SUB JUMP(C,DR,DC)

303 CALL POSITION(#1,DR,DC) :: CALL LOCATE(#1,DR,DC)

307 T=T+1

310 CALL LOCATE(#1,DR-T,DC)!UP

315 CALL KEY(1,K,S) :: IF K=18 THEN GOTO 307

317 CALL POSITION(#1,SR,SC)!FINDSTARTOFJUMP

330 CALL LOCATE(#1,DR+1,DC)!DOWN

335 !F DR<>SR THEN GOTO 330

340 CALL KEY(1,K,S) :: IF K=-1 THEN GOTO 330

350 SUBEND

post-19460-0-55735500-1315698389_thumb.jpg

Edited by orion1052003
Link to comment
Share on other sites

try this, it's not perfect, but in searching the good value, it's not so bad :

 

 

1 CALL CLEAR

2 CALL MAGNIFY(2):: PRINT "PRESS FIRE TO BOUNCE"

10 x=60

20 y=60

30 tj=20 :: way=1

100 CALL CHAR(110,"9898FF197848C80C")

110 CALL SPRITE(#1,110,2,y,x,0,10)

120 CALL KEY(1,K,S)

130 IF K=18 THEN 200

131 IF K=-1 THEN 210

140 GOTO 120

200 P1=(TJ/10) :: TJ=TJ-P1 :: CALL MOTION(#1,-TJ,10):: GOTO 120

210 P1=(TJ/10) :: TJ=TJ+P1 :: CALL MOTION(#1,TJ,10):: GOTO 120

220 GOTO 120

Link to comment
Share on other sites

I would make the player character follow a pre-computed path during such movements as jumps, ducking, etc. BASIC and XB are really slow when it comes to "action" type games, but the idea is something like this:

CALL CLEAR

R=12::
C=16

X=(C-2)*8+1::
Y=(R-1)*8+1

CALL HCHAR(R,C,65,2)
CALL SPRITE(#1,42,2,Y,X)

RESTORE Jump

FOR XD=1 TO 24
 READ YD
 CALL LOCATE(#1,Y-YD,X+XD)
NEXT XD

Jump:
 DATA 1,2,4,5,5,6,7,7
 DATA 8,8,8,8,8,8,8,8
 DATA 7,7,6,5,5,4,2,1

 

You can use TIdBiT (http://codehackcreate.com/archives/237) to translate that to XB code, which I have included here:

100 CALL CLEAR
110 R=12:: C=16
120 X=(C-2)*8+1:: Y=(R-1)*8+1
130 CALL HCHAR(R,C,65,2)
140 CALL SPRITE(#1,42,2,Y,X)
150 RESTORE 200
160 FOR XD=1 TO 24
170 READ YD
180 CALL LOCATE(#1,Y-YD,X+XD)
190 NEXT XD
200 DATA 1,2,4,5,5,6,7,7
210 DATA 8,8,8,8,8,8,8,8
220 DATA 7,7,6,5,5,4,2,1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...