Jump to content
IGNORED

Sprite with Ball, Missile, and Collision (example program)


Random Terrain

Recommended Posts

Latest Version:

 

This is a fixed version where the little guy you move around has better fake/real collision detection. It no longer overlaps the playfield pixels like it did sometimes in the first version. It corrects itself as soon as it starts to happen, so the problem I had in the first version is eliminated. In other words, similar to what SeaGtGruff said below, it uses a combination of 'collision prevention' and collision detection to make the sprite behave properly. This is the smoothest sprite/wall collision I've seen in a bB program so far. Move the sprite around the playfield pixels and see for yourself.

 

 

Here's the .bin file to use with an emulator or Harmony cartridge:

 

ex_sprite_with_ball_missile_and_collision_2011y_06m_16d_0425t.bin

 

 

Here's the bB code:

 

ex_sprite_with_ball_missile_and_collision_2011y_06m_16d_0425t.bas

 

 

 

 

Old Version:

 

This is the first draft of an example program that has a sprite, a bouncing ball, a missile you can shoot, and a mix of real and fake collision detection.

 

Use the joystick to move the sprite. Press the fire button to shoot the missile. Press the reset switch to reset the program and toggle between two screens.

 

 

Here's the .bin file to use with an emulator or Harmony cartridge:

 

ex_sprite_with_ball_missile_and_collision_2011y_06m_10d_0334t.bin

 

 

Here's the bB code:

 

ex_sprite_with_ball_missile_and_collision_2011y_06m_10d_0334t.bas

 

 

I think it took about a week, but I finally got the ball to bounce around without screwing up and acting weird. I'm still not happy with the code. After trying all kinds of things, it started working, but I don't know why or how. If someone with a bigger brain can make it work using better code, I'd appreciate it.

 

The fake collision detection for the Player0 sprite using pfread works, but it's not as good as I'd like it to be. The sprite can overlap playfield pixels a little bit depending on how you move. Again, if anyone can improve on the code, please do so.

 

It would be nice if this example program was in better shape before I put it on the bB page.

Edited by Random Terrain
Link to comment
Share on other sites

Here's the .bin file to use with an emulator or Harmony cartridge:

Only now I realize you made a manual for Harmony cartridge.

You're the best!

I didn't make it, I just made an adapted HTML version of the official PDF file for people who don't like to use PDF files. The page originally wasn't even going to have the manual on it:

 

http://www.atariage.com/forums/topic/181020-i-just-bought-one-and-have-a-few-thoughts/page__p__2269074#entry2269074

 

 

 

 

I was working on something, but it doesn't work any better than your code does. It's fine for learning purposes as is.

Thanks for trying. Maybe something will pop into one of our brains some time in the future to make it better.

Edited by Random Terrain
Link to comment
Share on other sites

New version in first post.

 

An idea about how I could improve this program popped into my head when I was sitting in the car yesterday, so I tried it last night and it worked. It still has the same smooth movement as you slide around the 'walls,' but now the sprite won't overlap the playfield pixels.

Link to comment
Share on other sites

In case anyone was wondering, if some of the example programs I'm adding to the bB page are a little too advanced for beginners, I'm not going to worry about it. They'll eventually need this stuff. I wish I had this smooth fake/real wall collision a few years ago. Oh well, at least I have it now. It should be useful when I eventually make my adventure game. I might even be able to adapt part of the code to use with Seaweed Assault.

Edited by Random Terrain
Link to comment
Share on other sites

Here are the example programs I have so far on the bB page:

 

Move Sprite

 

Sprite with Missile

 

Sprite with Ball

 

Sprite with Ball, Missile, and Collision

 

Sprite/Playfield Priority

 

Sprite Using Fixed Point Variables

 

Sound Example Using Data and Bankswitching

 

 

 

Can you think of others I should make before I go back to trying to get some games finished?

Link to comment
Share on other sites

It no longer overlaps the playfield pixels.

If there's no overlapping of pixels, then it isn't "collision detection," because a collision occurs only when the pixels of two objects overlap. What you're doing is "collision prevention"! Now if you could just find a way to apply your algorithms to the transportation industry, you'd make the highway patrol and insurance companies very, very happy! ;) :thumbsup:

 

Michael

Link to comment
Share on other sites

If there's no overlapping of pixels, then it isn't "collision detection," because a collision occurs only when the pixels of two objects overlap. What you're doing is "collision prevention"!

Oops. I reworded the first post so it would be more clear. It uses a combination of 'collision prevention' and 'collision detection' to make the sprite behave properly.

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