Jump to content
The Maxx

Maxximum Confusion

Recommended Posts

Questions answered in this thread:

1. Is there a way to run a loop to check variables by an index?

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3646843


2. Player collision event is triggered when player0 comes into contact with player2 or player3

(ie. if collision(player0,player1) then bopFish=3)

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3646508


3. DPC Starfield not working (http://atariage.com/forums/topic/258938-bb-starfield-effect/?hl=%2Bstarfield&do=findComment&comment=3638997)

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3646508


4. Can the starfield be resized horizontally?

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3646874


5. Is there some sort of modulo operator?

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3649164


I don't quite understand the bitwise stuff yet. For now, I am using something like:

temp4=eatSnot/16 temp5=eatSnot*16-temp4 ; temp5 returns eatSnot mod 16

6. What about gosub and bankswitching?

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3651610

7. Can the background be stretched?

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3651974

8. On functions:

http://atariage.com/forums/topic/259786-test-variables-by-index-and-other-questions/?p=3655650

 

9. Can you toggle a bit on/off...?

 

http://atariage.com/forums/topic/259786-questions-to-the-maxx-heh-see-what-i-did-there/?p=3656980

 

10. Can you cycle through colors in a sprite with the DPC+ kernel?

 

http://atariage.com/forums/topic/259786-questions-to-the-maxx-heh-see-what-i-did-there/?p=3657551

 

11. What is this pointer stuff?

 

http://atariage.com/forums/topic/259786-maxximum-confusion/?p=3659304

 

12. Use a table for subpixel movement:

 

http://atariage.com/forums/topic/259786-maxximum-confusion/?p=3665480

 

13. Can I give a label to bits?

 

http://atariage.com/forums/topic/146335-cycles-used-by-bb-operations/?p=2092258

 

14. What's up with missile0? Every time I try to change the height, it draws weird diagonal lines. Is there a way to get it to behave more like missile1? Short answer - if you download the starfield effect for one project, but don't plan on using it for another.... don't store your new project in the folder that has the starfield .asm file.

 

http://atariage.com/forums/topic/259786-maxximum-confusion/?p=3676875

 

15. Can I get missile1 to be any wider than 8 pixels?

http://atariage.com/forums/topic/259786-maxximum-confusion/?p=3677122

 

16. If I understand correctly (which is unlikely), all of the graphics are crammed into one bank. I am running out of room in that bank - is there a way to store more in another bank?

http://atariage.com/forums/topic/259786-maxximum-confusion/?p=3677122

 

Unanswered questions in this thread:

1. In the DPC+ kernel, can you assign a single color to a sprite? If so, will it save cycles?

2. My Visual bB does not have the options listed in the manual. Am I using the wrong version of Visual bB?

 

3. Can anyone offer an explanation/example of SeaGtGruff's read/write array?

http://atariage.com/forums/topic/171024-quick-yes-or-no-question-on-variable-arrays/?p=2116346

 

Edited by The Maxx

Share this post


Link to post
Share on other sites

I'll try to help you as best I can. But personally I'm somewhat of a programming noob.

 

1. Is there a way to run a loop to check variables by an index?

No Idea. But when you compile I think it generates a file that lists the variables you used.

2. Player collision is not working the way I expected. For example:

if collision(player0,player1) then bopFish=3

The event is also triggered whenever player0 comes into contact with player2 or player3. Is this normal?

 

Yes, I ran into this with my game as well. Player Sprites 1-9 are all copies of the Player1 sprite. So when you call collision with player1, you are calling a collision with all the copies. You will need to create some kind of system that identifies what sprite you are trying to interact with. There is a demo on Random Terrain's site that creates a coordinate system for virtual sprites. I used for my game and it worked like a charm.

3. I would really like to use the starfield code in my project:

http://atariage.com/...ld#entry3638997

The example DPC+ .bas file compiles, but the starfield effect is not present. The starfield .bas for the default kernel works fine, but my game needs some of the extras that DPC+ provides. I ran the .bin file in Stella and it works correctly. Am I missing something?

 

I'm guessing you have a vertical line running across your screen. There is an .asm file you need to save in your game file that makes the star field work. You can download the file in the second message of the star field thread.

It also helps if you post your code, bin file and screenshot.

 

Hope that helps a little.

  • Like 3

Share this post


Link to post
Share on other sites

Does #1 mean that you want to see what variables have been used in a program? If so, you can right click in the code editor and select "Audit Variables." It only works for people who use dim.

 

[i typed that before seeing your reply above.]

  • Like 1

Share this post


Link to post
Share on other sites

If the variables are in consecutive memory locations, you can access them as an array with a loop.

 

  dim playerPos = a
  dim bomb1Pos = b
  dim bomb2Pos = c
  dim bomb3Pos = d
  dim bomb4Pos = e

  for temp1=0 to 3
     if playerPos = bomb1Pos[temp1] then goto PlayerGoesBoom
  next

Generally speaking, using an array this way only saves rom if you use it for 3 or more elements.

  • Like 1

Share this post


Link to post
Share on other sites

sweet! thank you! this should come in handy!!! You guys have been loads of help! Thanks!

Edited by The Maxx

Share this post


Link to post
Share on other sites

The height and vertical position of the starfield can be changed (with the missile height and y coordinate variables), but not the width.

  • Like 1

Share this post


Link to post
Share on other sites

<edit>

 

This was formerly a big ugly comment that described several methods I'd tried to use to get my for loop working. As it turns out, I was using too much ROM and needed to condense some code or bankswitch.

Edited by The Maxx

Share this post


Link to post
Share on other sites

I don't quite follow you so maybe I'm missing something


why don't you just do something like






schnooga=0

for temp1=0 to 17

if shnooga = 2 then skip_schnooga
if ooga-2=booga[temp1] then schnooga=1
if ooga-1=booga[temp1] then schnooga=2

skip_schnooga
next



you can do somthing like modulo for powers of 2 in binary using AND (ie "&" in bB)


15 mod 8 is

15 & 7

7 being 8 - 1

in binary %00001000 (8 ) and %00000111 (7)


bB does a bitwise AND

bits in the result are the ANDing of corresponding bits in the operands




AND is
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

%00001111 (15)
& %00000111 (7)
= %00000111 (7)

%00001110 (14)
& %00001101 (13)
= %00001100 (12)





the player 1..9 variables are in order in memory

so you should be able to eg address player3x as player1x[2]

but I haven't tryed it

Edited by bogax

Share this post


Link to post
Share on other sites

It worked after I went through, optimized some code, and freed up some ROM. I use the term "optimized" loosely. I think you'd be horrified to see my script! Haha!

Edited by The Maxx

Share this post


Link to post
Share on other sites

I am using the DCP+ kernel. I have each player's color set like:

 

player0color:

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

$C4

end

 

However, for my first game, I don't think I'm going to go beyond a single color for each player. Is there a way to choose a single color (ie $C4) for the sprite. If so, would it be beneficial... save rom/cycles, etc?

Edited by The Maxx

Share this post


Link to post
Share on other sites

<edit>

 

It turns out that the flash was eliminated by calling defining the playfield and calling drawscreen again. :)

Edited by The Maxx

Share this post


Link to post
Share on other sites

I was reading up on bankswitching and I think I know how it could make my game better. At the very least, it would serve to organize my code in a more readable way. I'm a little confused about gosub. I need to read more, maybe? I don't see how it differs from goto...?

Edited by The Maxx

Share this post


Link to post
Share on other sites

I was reading up on bankswitching and I think I know how it could make my game better. At the very least, it would serve to organize my code in a more readable way. I'm a little confused about gosub. I need to read more, maybe? I don't see how it differs from goto...?

When I learned about GOTO and GOSUB in the 1980s for the Commodore VIC-20, GOSUB was used if multiple places in the program needed to use the same code.

 

That still seems to be true when using batari Basic. New users of bB will often use GOSUB when they don't even need it. They just hop all over the place and create tangled spaghetti code that is almost impossible to follow.

 

Another reason to only use GOSUB when it is absolutely necessary is that it wastes more cycles:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#cycle_count_goto

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#cycle_count_gosub

  • Like 1

Share this post


Link to post
Share on other sites

Some of the kids at school thought that the miners looked like galaga spaceships. So this morning I decided to experiment with color.

 

If you're using the DPC+ Kernal, I would take full advantage of the color capabilities. It's wasted if you don't.

Share this post


Link to post
Share on other sites

Thanks guys. This is great information, as always. :)

 

I'll play some more with color today. I tried adding a couple of things this morning and started crashing stuff. I might have to tear things up and start a new .bas file. Admittedly, I didn't have a plan laid out when I started (I never do) and there is some "spaghetti code" in the mix. Hopefully there are some meatballs as well... but it's my first shot, so I won't cry too much if I fall flat on my face. :D

 

<edit>

 

"Crashing" due to running out of ROM.

Edited by The Maxx

Share this post


Link to post
Share on other sites

Can the background color be resized horizontally to match the playfield? I am assuming probably not... like the starfield effect?

Edited by The Maxx

Share this post


Link to post
Share on other sites

New question: can the background color be resized horizontally to match the playfield? I am assuming probably not... like the starfield effect?

Run this program and press the select switch over and over again:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_dpc_frac

Share this post


Link to post
Share on other sites

Cool program! :) I looked at it once before, but I couldn't make heads or tails of it then. Now that I've played around in bB, I can see what it's illustrating. Thanks!

Edited by The Maxx

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.
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...