Search the Community
Showing results for tags 'fish'.
-
QUESTION: How to make a fish tail move? So this is a (brief) STUDY in FISH PHYSICS Hoping this helps others with fish. Here goes...
- 28 replies
-
- fishphysics
- fish
-
(and 1 more)
Tagged with:
-
I am currently making my first game in phaser, where a fish bounces around the screen and eats fish that you spawn in yourself. I am having 2 issues. First off when he bounces off the walls the walls move and occasionally disappear and also when you spawn more than one fish only the most recent fish will be eaten. Here's my code: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /><title>Fishtank Game</title><script type="text/javascript" src="js/phaser.min.js"></script> <style type="text/css"> body { margin: 0; } </style></head><body> <script type="text/javascript"> var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() {game.load.image('water', 'assets/water1.png');game.load.image('fish', 'assets/fish.png');game.load.image('wall', 'assets/hidden wall.png');game.load.image('wall2', 'assets/wall flipped.png');game.load.image('smallfish', 'assets/smallfish.png'); var begin = true; var fish;var wallRight;var wallLeft;var smallFish; var createKey; //var fishAngles = ['-100', '100', '-150', '150', '-200', '200', '-250', '250', '-300', '300'];//var angle = fishAngles[Math.floor(Math.random()*fishAngles.length)]; } function create() { smallFish = 'smallfish'; createKey = game.input.keyboard.addKey(Phaser.Keyboard. ; game.physics.startSystem(Phaser.Physics.ARCADE); game.physics.arcade.checkCollision.down = true; game.add.sprite(0,0, 'water'); wallRight = game.add.sprite(799, 0, 'wall'); game.physics.enable(wallRight, Phaser.Physics.ARCADE); wallRight.body.bounce.set(1); wallLeft = game.add.sprite(-80, 0, 'wall'); game.physics.enable(wallLeft, Phaser.Physics.ARCADE); wallLeft.body.bounce.set(1); ceiling = game.add.sprite(0, -80, 'wall2'); game.physics.enable(ceiling, Phaser.Physics.ARCADE); ceiling.body.bounce.set(1); floor = game.add.sprite(0, 599, 'wall2'); game.physics.enable(floor, Phaser.Physics.ARCADE); floor.body.bounce.set(1); fish = game.add.sprite(0, 250, 'fish');fish.anchor.set(0.5);fish.checkWorldBounds = true; game.physics.enable(fish, Phaser.Physics.ARCADE); fish.body.collideWorldBounds = true;fish.body.bounce.set(1); game.input.onDown.add(releasefish, this); createKey.onDown.add(creation, this); } function creation () { smallFish = game.add.sprite(300, 400, 'smallfish');smallFish.anchor.set(0.5);smallFish.checkWorldBounds = true; game.physics.enable(smallFish, Phaser.Physics.ARCADE); smallFish.body.collideWorldBounds = true;smallFish.body.bounce.set(1); smallFish.body.velocity.x = 300;smallFish.body.velocity.y = 400;} function releasefish () { if(begin = true){begin = false;fish.body.velocity.y = -500 - Math.random();fish.body.velocity.x = -300 - Math.random(); wallLeft.x = -79;wallRight.x = 799;ceiling.y = -80;floor.y = 599;}} function update() { game.physics.arcade.collide(fish, wallRight, fishHitRight, null, this);game.physics.arcade.collide(fish, wallLeft, fishHitLeft, null, this);game.physics.arcade.collide(fish, ceiling, fishHitCeiling, null, this);game.physics.arcade.collide(fish, floor, fishHitFloor, null, this); game.physics.arcade.collide(smallFish, wallRight, smallFishHitRight, null, this);game.physics.arcade.collide(smallFish, wallLeft, smallFishHitLeft, null, this);//game.physics.arcade.collide(smallFish, ceiling, smallFishHitCeiling, null, this);//game.physics.arcade.collide(smallFish, floor, smallFishHitFloor, null, this); game.physics.arcade.collide(fish, smallFish, eating, null, this);} function fishHitRight() { var diff = 0; fish.scale.x = -1;wallLeft.x = -80;ceiling.y = -80;floor.y = 599; if (fish.y < wallRight.y) { diff = wallRight.y - fish.y; fish.body.velocity.y = (-2 * diff + Math.random()); }else if (fish.y > wallRight.y) { diff = fish.y - wallRight.y; fish.body.velocity.y = (2 * diff - Math.random()); }else { fish.body.velocity.y = 2 + Math.random() * 12; }} function fishHitLeft() { var diff = 0; fish.scale.x = 1;wallRight.x = 799;ceiling.y = -80;floor.y = 599; if (fish.y < wallLeft.y) { diff = wallLeft.y - fish.y; fish.body.velocity.y = (2 * diff - Math.random()); }else if (fish.y > wallLeft.y) { diff = fish.y - wallLeft.y; fish.body.velocity.y = (-2 * diff + Math.random()); }else { fish.body.velocity.y = 2 + Math.random() * 12; } } function fishHitCeiling() { var diff = 0; wallLeft.x = -80;wallRight.x = 799;floor.y = 599; if (fish.x < ceiling.x) { diff = ceiling.x - fish.x; fish.body.velocity.x = (-2 * diff + Math.random()); }else if (fish.x > ceiling.x) { diff = fish.x - ceiling.x; fish.body.velocity.x = (2 * diff - Math.random()); }else { fish.body.velocity.x = 2 + Math.random() * 12; }} function fishHitFloor() { var diff = 0; wallLeft.x = -80;wallRight.x = 799;ceiling.y = -80; if (fish.x < floor.x) { diff = floor.x - fish.x; fish.body.velocity.x = (-2 * diff + Math.random()); }else if (fish.x > floor.x) { diff = fish.x - floor.x; fish.body.velocity.x = (2 * diff - Math.random()); }else { fish.body.velocity.x = 2 + Math.random() * 12; }} function smallFishHitRight() { smallFish.scale.x = -1;wallLeft.x = -80;} function smallFishHitLeft() { smallFish.scale.x = 1;wallRight.x = 799; } function eating(fish, smallfish) { smallFish.kill();} </script> </body></html>
-
Hi! I have finally finished my first game! (The gameplay is not so good, but i had no better idea) You have to swim further and catch the smaller fishes, but avoid the biggers and sharks. There are some power-ups, and upgrades too. You can try it here: http://www.kongregate.com/games/horizon02/bobby-the-fish Move with mousedown , arrows, or touch
-
Hello! I am 27thColt. This is my first game that I have ever made! It is called Floater (couldn't think of better names). You are a Scuba Diver avoiding fish and collecting coins and bubbles! Here is the link: http://27thcolt.github.io/Floater/ Here are some pictures: If you want, here is the repository: https://github.com/27thColt/Floater Just don't steal my code guys, it's not cool. Hopy you enjoy the game!
-
Hi! This is my first cross-platform project created with Gamemaker Studio. Inspired by Joyride Jetpack Fishy Rush is an extremely addictive and challenging adventure in the underwater world! Collect coins, catch power ups, complete quests and buy upgrades. Enjoy! Features - Endless gameplay with auto-generated quests - Fantastic 3D graphics and sound effects - A lot of upgrades, power-ups and achievements - Multi-language support: English, German, Russian and Turkish Controls Tap to swim up. Release to swim down. Play game (HTML5) - http://fishyrush.com/demo Improved version of Fishy Rush available for mobile markets:
-
Submarine Escape is a game, in which you have to go with your submarine as far as possible. Avoid obstacle and collect fuel so you earn more score. So feel free to play the game and compare your results with the 10 best players in the online highscore table. Home page: http://www.raiper34.net/en Run! Screens: