Jump to content
IGNORED

Commodore Pet - Character Movement By Angle


evildead9000

Recommended Posts

Hello all once again!

 

I'm not quite sure how to go about implementing my next bit of code, but here goes.

 

I have two characters on-screen; let's say A, which is at the top left of the screen and B, which is in the center of the screen.

The player enters an angle to fire a projectile; let's say 45 degrees. I would like another character to appear, as if were fired by letter A, at said angle toward B.

Kind of like an Artillery Duel of sorts. (the game where two cannons fire at each other from different sides of the screen using angles.)

 

However, if the angle is incorrect the projectile will miss B. Afterwards, B will move closer to A.

I was thinking that I would need to create a peek loop to check all chars on screen (or of a specific area) until A is found, then repeat for B. Once both locations are collected, get the angle of B in relation to A.

Afterwards, the projectile would be poked into a location next to A and move toward B at the angle the player entered.

 

Whew! With that said, I'm not sure I'm in the right ball park of how to implement. Please provide some feedback as to whether this is a decent approach and if not, let me know a better one.

I think once I understand this, I could really move forward with my code. So far I've tested numerous different parts and have made okay progress.

 

Thanks much!

 

Also, is it possibly better to first get line coordinates from A to B (as if to draw a line from one to the other) to obtain the HIT angle? Then draw another line from A toward B at the angle the player entered.

 

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