Jump to content

Recommended Posts

For reflection code, I wonder if it would be helpful to keep track of the previous positions of both the ball and the paddle? That way if the ball hits the paddle and the paddle hasn't moved, then you could have the ball reflect on the opposite direction that it came from. Otherwise, if the paddle hits the ball, then have the ball jump back in the direction that the paddle is going. It's not perfect physics, but it may be a decent starting point?

 

Maybe others will have better ideas on how to compute this in a more realistic way.

Thanks, that's a good idea.

 

I didn't have much luck getting the modulus with the // operator, either, but I changed how I did it, and didn't look into it deeply at the time. Maybe it would be good to test it with a small test program that's easier to debug.

If it's not too much to ask, could you find it?

Share this post


Link to post
Share on other sites

I don't even remember what section code I was working on where I was trying to get the modulus. It was rewritten in a way that the modulus was no longer needed.

If you want to get the modulus manually, you could do something like this:

   temp1 = dividend / divisor
   modulus = dividend - (temp1 * divisor)

If you want to report a bug with the // operator, I suggest starting a new thread, and creating a small test program that demonstrates the problem.

  • Like 1

Share this post


Link to post
Share on other sites

Is it possible to do a modulus operation without the advanced math modules?

If you can limit it to a power of 2 I think you can just do a bitwise AND of 2n-1.

 

5 mod 2 = 5 & 1 = 1

Share this post


Link to post
Share on other sites

I don't even remember what section code I was working on where I was trying to get the modulus. It was rewritten in a way that the modulus was no longer needed.

 

If you want to get the modulus manually, you could do something like this:

 

   temp1 = dividend / divisor
   modulus = dividend - (temp1 * divisor)

If you want to report a bug with the // operator, I suggest starting a new thread, and creating a small test program that demonstrates the problem.

Thanks! I'll have to try this.

Share this post


Link to post
Share on other sites

Hmmm, now I'm getting this error:

--- Unresolved Symbol List

      284 bytes of ROM space left

C:\Users\chris\atari\airHockey\air hockey\airhockey.bas.asm (3437): error: Branch out of range (158 bytes).

Fatal assembly error: Source is not resolvable.
Errors were encountered during assembly

What does it mean by "branch out of range"?

 

That reminds me, I hope RT is doing okay.

 

Here's the code:

airhockey.bas

Edited by 8-bit_d-boy

Share this post


Link to post
Share on other sites

If you change this:


   if scoring <> 61 then _skip_ball_movment



to this:

   if scoring <> 61 then goto _skip_ball_movment



It will compile.

Share this post


Link to post
Share on other sites

YOU'RE ALIVE!!

If you change this:


   if scoring <> 61 then _skip_ball_movment



to this:

   if scoring <> 61 then goto _skip_ball_movment



It will compile.

Oh crap, its so simple, how did I miss it? :P

 

Also I think I forgot to mention, I added use of the difficulty switches: players will no longer be able to move fast with the fire button with the switch set to "Advanced".

EDIT:

So I compiled it and it works!
That said, I have good news, and bad news.

 

Bad news is I kinda forgot how some of my code worked(or at least was supposed to) and some bugs got introduced where the ball gets stuck in the bottom edge of the playfield and the ball doesn't move horizontally when you hit it from the side so I can't tell if that fixed the clipping issue.

 

Good news is there's like 1 frame where the screen flickers when you hit the ball at full force which looks REALLY cool, I'll include the ROM so you can see for yourself!

airhockey.bas

airhockey.bas.bin

Edited by 8-bit_d-boy

Share this post


Link to post
Share on other sites

So by playing around with the code for about a minute, I've regained some understanding of how the code works and the bug where the ball does not move in a straight horizontal line when hit from the side is caused by the clip check code I just fixed(duh):

	temp6 = bvx + bvy
	if bvx > bvy then temp5 = bvx / bvy : temp4 = bvy else temp5 = bvy / bvx : temp4 = bvx
	
		for temp3 = 0 to temp4
			temp2 = temp3 / temp4
			temp1 = temp3 - (temp2 * temp4)
			if temp1 = 0 then if bvx > bvy then bally = bally + 1 : if bvy > bvx then ballx = ballx + 1
			if temp1 <> 0 then if bvx > bvy then ballx = ballx + 1 : if bvy > bvx then bally = bally + 1
			if collision(player0, ball) || collision(player1, ball) then temp3 = temp4
		next

I'm gonna stare at it for a bit to try to figure out why it's not working properly.

Share this post


Link to post
Share on other sites

Hey, guys, been a while. The GPU in my main computer died a couple weeks ago, so I've been using my laptop and just haven't signed in. I'll have to set up Batari Basic to get back to workin' on this.

  • Like 2

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