Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6143135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:28:58+00:00 2026-05-23T18:28:58+00:00

I have successfully made fish1 and fish2 move across the screen, but i am

  • 0

I have successfully made fish1 and fish2 move across the screen, but i am having a hard time figuring out how to get fish3 to move from right to left. Seeing how its facing to the left, I don’t want it to swim backwards. Any help or advice is greatly appreciated!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Fish Tanks</title>

<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
var fish1Position = 0;
var fish2Position = 0;
var fish3Position = 99;
var horizontal = [];
var fillPosition = 10;
var num = 100;
for(var i = 0; i < 100; ++i) {
        horizontal[i] = fillPosition;
        fillPosition += 10;
}

function fish1Swim() {
        document.getElementById("fish1").style.left = horizontal[fish1Position] + "px";
        ++fish1Position;
        if (fish1Position == num) {
                fish1Position = 0;
}
var tim1 = setTimeout(fish1Swim, 100);
}
function fish2Swim(){
        document.getElementById("fish2").style.left = horizontal[fish2Position] + "px";
         ++fish2Position;
         if (fish2Position == num) {
                 fish2Position = 0;
}
var tim2 = setTimeout(fish2Swim, 200);
}

function fish3Swim() {
     document.getElementById("fish3").style.left = horizontal[fish3Position] + "px";
     ++fish3Position;
     if (fish3Position == num) {
fish3Position = 99;
}
var tim3 = setTimeout(fish3Swim, 300);
}

function startSwimming() {
        fish1Swim();
        fish2Swim();
        fish3Swim();
}

// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body onload="startSwimming();">
<p><span id="fish1" style="position:absolute; left:10px; top:10px"><img src="fish1.gif" alt="Image of a fish" /></span></p>
<br />
<br />
<br />
<br />
<p><span id="fish3" style="position:absolute; left:10px; top:100px"><img src="fish3.gif" alt="Image of a fish" /></span></p>
<br />
<br />
<br />
<br />
<p><span id="fish2" style="position:absolute; left:10px; top 150px"><img src="fish2.gif" alt="Image of a fish" /></span></p>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:28:59+00:00Added an answer on May 23, 2026 at 6:28 pm

    I guess you just want to decrement the position, so:

    --fish3Position;
    

    instead of ++fish3Position;.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully made a custom control-slider, but it's not draggable. I tried searching
I have successfully made an facebook application which shows real time data from facebook
I have successfully made an application but whenever I try installing it in the
I have successfully made a script that filters out duplicate lines in a file
I'm using Pex and Moles 0.94.51023.0 with VS2010 SP1. I have successfully made some
i have made my custom Static Library (.a) successfully. i have tested it in
I have successfully made contact with the internet and parsed a few documents via
So I have successfully made a ray the represents the mouse unprojected into the
I have successfully made a very simple LevelHelper/Box2D/Cocos2D project. I am now trying to
Ok, so I have successfully made my first in-app Email app using MFMAilComposer. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.