Jump to content
IGNORED

Advice for improving player vs player base code?


SloeGin

Recommended Posts

I'm trying to code some groundwork for a game idea. So far I have the following done:

1) Move player0 and player1 around the playfield and fire a missile

2) Player must wait for missile to reach end of playfield before firing again

3) Missiles fire in direction player is facing

4) The sprite for a player changes relative to the direction the player is moving

5) Scroll the playfield when a player tries to move beyond playfield boundaries

6) When a player causes the playfield to scroll, adjust the other player's x/y relative to the playfield

7) If both players are at full opposite ends of the playfield, do not scroll

 

There's no collision detection or sound and the sprites are purely functional.

 

How can I simplify my code? Specifically, I'd like to be able to remove the tons of redundancies. Right now I'm doing almost everything twice: once for player0/joy0/missile0, then do the same thing for player1/joy1/missile1. How can I make these into individual subroutines that know which player's attributes to modify?

 

I feel like I'm way over thinking the "Playfield Magic" section. Any thoughts/advice on a better way to accomplish this?

 

(edit: changed topic title)

(updated code: added x/y correction for missiles, still not perfect though)

 

pvpbasecode.bas

pvpbasecode.bin

Edited by SloeGin
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...