
3.1 HTML Structure
The main elements include:
Example:
<div id=”gameContainer”>
<div id=”player”></div>
<div class=”trash” id=”recyclableTrash”></div>
<div class=”trash” id=”nonRecyclableTrash”></div>
<div class=”platform” id=”platform1″></div>
</div>
3.2 CSS Styling
CSS defines the visual layout:
#gameContainer {
width: 800px;
height: 600px;
position: relative;
background-image: url(‘city_background.png’);
background-size: cover;
}
#player {
width: 50px;
height: 50px;
position: absolute;
background-image: url(‘player_sprite.png’);
}
.trash {
width: 30px;
height: 30px;
position: absolute;
}
.platform {
width: 100px;
height: 20px;
position: absolute;
background-color: gray;
}
4.1 Character Movement
Code Example:
document.addEventListener(‘keydown’, (e) => {
if (e.key === ‘ArrowLeft’) movePlayer(-10, 0);
if (e.key === ‘ArrowRight’) movePlayer(10, 0);
if (e.key === ‘ ‘) jumpPlayer();
});
function movePlayer(x, y) {
const player = document.getElementById(‘player’);
player.style.left = (parseInt(player.style.left) || 0) + x + ‘px’;
}
function jumpPlayer() {
// Logic for jumping
}
Example:
function playSound(type) {
const sound = new Audio(type === ‘recyclable’ ? ‘recyclable.mp3’ : ‘nonRecyclable.mp3’);
sound.play();
}
Conclusions
City Platform is an educational game that highlights the critical importance of identifying recyclable waste. Through its combination of platform elements and dynamic collection mechanics, the game provides an engaging and instructional experience, making it an ideal tool to raise public awareness about proper waste management.
The game stands out by blending entertainment with environmental education, creating a fun and immersive experience that appeals to players of all ages. Its platforming mechanics require players to navigate urban landscapes, collect waste, and accurately sort it, thereby reinforcing the concepts of recycling in an interactive manner. The inclusion of both static and moving platforms adds a layer of challenge and excitement, encouraging players to think critically and act quickly.
Beyond gameplay, City Platform serves as a valuable resource for promoting sustainability and environmental responsibility. By integrating realistic scenarios and tangible goals, the game inspires players to reflect on their habits and adopt more eco-friendly behaviors in their everyday lives. Its intuitive design and accessible structure make it a powerful educational tool, capable of driving meaningful change in how individuals perceive and manage waste.
In summary, City Platform is not just a game; it is a call to action, aiming to foster a culture of sustainability and responsible waste management through an engaging and interactive digital experience.