Skip to content

Rocks form a wall in FoodChain Activity #2135

Description

@GAMinsect

As seen in the video the rocks can create a barrier that doesn't allow the player to move to the other side of the game field.

Screencast.da.2026-04-12.21-40-46.webm

Although the player could still win by just waiting for the flies to fly in the area it can reach, It don't think it's intended game design.

It should be fixed by adding a new check to the intersect function:

// Set randomely rocks
		this.rocks = [];
		for(var i = 0 ; i < FoodChain.playLevels[this.level-1].rocks ; i++) {
			// Ensure distance between blocks and between block and frog is sufficient
			var rock = FoodChain.createWithCondition(
				// Create randomly a new rock...
				function() {
					var x = 130+Math.floor(Math.random()*(FoodChain.playArea.width-300));
					var y = 130+Math.floor(Math.random()*(FoodChain.playArea.height-200));
					var h = Math.floor(Math.random()*4)*90;
					return new Sprite({
						x: x, y: y, heading: h, images: ["rock"], width: FoodChain.sprites.rock.dx, height: FoodChain.sprites.rock.dy, index: 0
					});
				},

				// ... while don't intersect with ...
				function(n, s) {
					return !n.intersect(s); // ADD here something like, && n.distance(s) > 200
				},

				// ... other rocks and frog
				enyo.cloneArray(this.rocks).concat(this.frog)
			);
			this.rocks.push(rock);
		}

let me know what you think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions