Jump to content
Sign in to follow this  
Philsan

Indy 500 style game question

Recommended Posts

I would like to program (Turbo-Basic XL) a simple Indy 500 style game.

This code works for 8 directions but I would like to have 16 (like the original) or 32 (like Atari Sprint2) directions.

Any ideas?

50 A=USR(PMMOVE,1,ADR(SHAPE$(INT(DI)*8-7)),SIZE,X,Y)
51 BT=STRIG(0):ST=STICK(0)
52 IF BT=0 THEN SP=SP+0.1
53 IF BT=1 THEN SP=SP-0.05
54 IF SP<=0 THEN SP=0:GOTO 50
55 IF SP>2 THEN SP=2
57 IF ST=11 THEN DI=DI-1
60 IF ST=7 THEN DI=DI+1
70 IF DI<1 THEN DI=8
80 IF DI>8 THEN DI=1
120 ON DI GOSUB 140,150,160,170,180,190,200,210
129 GOTO 50
140 Y=Y-SP:X=X:RETURN 
150 X=X+SP:Y=Y-SP:RETURN 
160 X=X+SP:Y=Y:RETURN 
170 X=X+SP:Y=Y+SP:RETURN 
180 Y=Y+SP:X=X:RETURN 
190 X=X-SP:Y=Y+SP:RETURN 
200 X=X-SP:Y=Y:RETURN 
210 X=X-SP:Y=Y-SP:RETURN

R5.zip

Edited by Philsan

Share this post


Link to post
Share on other sites

Unfortunately as I've not been using Basic for a long, long time (13 years), I've forgotten how I can load your program here. What do I need to do to run it? (sorry for the daft question!)... I tried - LOAD "D:R501.TBL" but this didn't work....

Share this post


Link to post
Share on other sites
Unfortunately as I've not been using Basic for a long, long time (13 years), I've forgotten how I can load your program here. What do I need to do to run it? (sorry for the daft question!)... I tried - LOAD "D:R501.TBL" but this didn't work....

ENTER "D:R501.TBL"

ENTER and LIST are used to load and save programs in their untokenized form (plain text).

Edited by Philsan

Share this post


Link to post
Share on other sites

Philsam...you should use Turbo Basic features and commands and not only the speed... ;)

 

f.e.

 

do,loop...

 

proc, endproc

 

if, else, endif etc... ;)

 

the question is how will you handle 16 directions with the joystick? then you have to think about "turn left/right" and up/down to speed up/down?

Share this post


Link to post
Share on other sites
Unfortunately as I've not been using Basic for a long, long time (13 years), I've forgotten how I can load your program here. What do I need to do to run it? (sorry for the daft question!)... I tried - LOAD "D:R501.TBL" but this didn't work....

ENTER "D:R501.TBL"

ENTER and LIST are used to load and save programs in their untokenized form (plain text).

 

Thanks for that Philsan. I've managed to load up and run the program now.

 

I'm in a similar situation to you here. I need to be able to have my cars in my Formula 1 game going in many directions.

 

I have it planned how I am going to animate my cars. Each car will be pre-drawn at every 5 degree angle (72 different cars in memory). I will then also have 2 look up tables for the directions in which the car should go (X and Y directions). These tables will be pre-calculated from sine/cosine values. I should then be able to achieve a car with relatively fluid movement. I think that if you try this, you should get the same results.

Share this post


Link to post
Share on other sites
Philsam...you should use Turbo Basic features and commands and not only the speed... ;)

Not only... DIR, RENUM, RENAME... :D

 

the question is how will you handle 16 directions with the joystick? then you have to think about "turn left/right" and up/down to speed up/down?

Exactly like Atari VCS Indy 500.

Left/right to turn, button to accelerate.

If you try the attached program you'll see.

Edited by Philsan

Share this post


Link to post
Share on other sites

You're probably best off having arrays with the Dx, Dy values (deltas).

 

e.g. car moving 45 degrees up/right would have Dx=1, Dy=-1, moving 22.5 degrees down/right would be Dx=1, Dy=0.25

 

Then you have your joystick movements just changing the index into the delta arrays.

Share this post


Link to post
Share on other sites

AA user Fort Apocalypse has sent to me the following deltas, but they are slightly different from mine.

Which ones have I to use?

 FORT APOCALYPSE  PHILSAN

1 0    -1      0    -1   
2 0.38 -0.92   0.3 -0.8
3 0.71 -0.71   0.7 -0.7
4 0.92 -0.38   0.8 -0.3
5 1     0      1     0
6 0.92 0.38    0.8   0.3
7 0.71 0.71    0.7   0.7
8 0.38 0.92    0.3   0.8
9 0     1      0      1
10 -0.38 0.92    -0.3 0.8
11 -0.71 0.71    -0.7 0.7
12 -0.92 0.38   -0.8   0.3
13 -1    0       -1     0
14 -0.92 -0.38 -0.8   -0.3
15 -0.71 -0.71 -0.7   -0.7
16 -0.38 -0.92 -0.3   -0.8

Fort Apocalypse's deltas are determined by the following: cos(0), sin(0), cos(pi/8),
sin(pi/8), cos(pi*2/8), sin(pi*2/8),
cos(pi*3/8), sin(pi*3/8), cos(pi*4/8), sin(pi*4/8), cos(pi*5/8), sin(pi*5/8),
cos(pi*6/8), sin(pi*6/8), cos(pi*7/8), sin(pi*7/8).

 

Here is my Turbo-Basic XL code:

A=USR(PMMOVE,1,ADR(SHAPE$((DI*-7)),SIZE,X,Y)
51 BT=STRIG(0):ST=STICK(0)
52 IF BT=0 THEN SP=SP+0.3
53 IF BT=1 THEN SP=SP-0.2
54 IF SP<=0 THEN SP=0
55 IF SP>2 THEN SP=2
57 IF ST=11 THEN DI=DI-1
60 IF ST=7 THEN DI=DI+1
70 IF DI<1 THEN DI=16
80 IF DI>16 THEN DI=1
85 OLDX=X:OLDY=Y
90 X=X+(DX(DI)*SP):Y=Y+(DY(DI)*SP)
100 IF X<48 OR X>201 THEN X=OLDX
105 IF Y<16 OR Y>105 THEN Y=OLDY
110 GOTO 50

 

I attach my program with my deltas.

Left/right to turn, fire to accelerate.

GTTurbo.zip

Edited by Philsan

Share this post


Link to post
Share on other sites

His ones are more precise.

 

Also note, X position changes are double the space of Y pos changes for PMGs, but it looks like you've already catered for that.

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...