Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
camouflaged-penguin authored Apr 14, 2021
0 parents commit f3529b0
Show file tree
Hide file tree
Showing 10 changed files with 556 additions and 0 deletions.
Binary file added assets/bomb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/dude.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/platform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
303 changes: 303 additions & 0 deletions game.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<title>Apfelschnappen</title>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
<style type="text/css">
body {
margin: 0;
}
</style>


</head>
<body>
<script type="text/javascript">

var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 300 },
debug: false
}
},
scene: {
preload: preload,
create: create,
update: update
}
};

var game = new Phaser.Game(config);
var score = 0;
var scoreText;
var gameend;
var endgame = 0;
var share = 0;

/* style für button */
var style = {
font: "32px Monospace",
fill: "#00ff00",
align: "center"
}

/* end of style*/

function preload ()
{
this.load.image('sky', 'assets/sky.png');
this.load.image('ground', 'assets/platform.png');
this.load.image('star', 'assets/star.png');
this.load.image('bomb', 'assets/bomb.png');
this.load.spritesheet('dude',
'assets/dude.png',
{ frameWidth: 32, frameHeight: 48 }
);
}

function create ()
{
this.add.image(400, 300, 'sky');

platforms = this.physics.add.staticGroup();

platforms.create(400, 568, 'ground').setScale(2).refreshBody();
/*
platforms.create(600, 400, 'ground');
platforms.create(50, 250, 'ground');
platforms.create(750, 220, 'ground');
*/
player = this.physics.add.sprite(100, 450, 'dude');

player.setBounce(0.2);
player.setCollideWorldBounds(true);

scoreText = this.add.text(16, 16, 'score: 0', { fontSize: '32px', fill: '#000' });

this.anims.create({
key: 'left',
frames: this.anims.generateFrameNumbers('dude', { start: 0, end: 3 }),
frameRate: 10,
repeat: -1
});

this.anims.create({
key: 'turn',
frames: [ { key: 'dude', frame: 4 } ],
frameRate: 20
});

this.anims.create({
key: 'right',
frames: this.anims.generateFrameNumbers('dude', { start: 5, end: 8 }),
frameRate: 10,
repeat: -1
});
this.anims.create({
key: 'left',
frames: this.anims.generateFrameNumbers('dude', { start: 0, end: 3 }),
frameRate: 10,
repeat: -1
});

cursors = this.input.keyboard.createCursorKeys();



stars = this.physics.add.group({
key: 'star',
/* repeat: 1, */
setXY: { x: (Phaser.Math.Between(150, 800)), y: 0, stepX: 70 }



});

stars.children.iterate(function (child) {

child.setBounceY(Phaser.Math.FloatBetween(0.4, 0.8));

});


/*var x = (player.x < 400) ? Phaser.Math.Between(400, 800) : Phaser.Math.Between(0, 400);
var bomb = bombs.create(x, 16, 'bomb');
bomb.setBounce(1);
bomb.setCollideWorldBounds(true);
bomb.setVelocity(Phaser.Math.Between(-200, 200), 20); */









bombs = this.physics.add.group();

this.physics.add.collider(bombs, platforms);

this.physics.add.collider(player, bombs, hitBomb, null, this);

this.physics.add.collider(player, platforms);
//this.physics.add.collider(stars, platforms);
//this.physics.add.collider(platforms, stars, collectGround, null, this);
this.physics.add.overlap(player, stars, collectStar, null, this);
this.physics.add.overlap(platforms, stars, collectGround, null, this);






}

function update ()
{
if (cursors.left.isDown)
{
player.setVelocityX(-300);

player.anims.play('left', true);
}
else if (cursors.right.isDown)
{
player.setVelocityX(300);

player.anims.play('right', true);
}
else
{
player.setVelocityX(0);

player.anims.play('turn');
}



if (cursors.up.isDown && player.body.touching.down && endgame == 0 && share == 0)
{
player.setVelocityY(-330);
}
else if (cursors.up.isDown && endgame == 1)
{location.replace("game.html")}
else if (cursors.up.isDown && share == 1)
/* {location.assign("img.html")} */
{location.replace("img.html")}

}


function collectStar (player, star)
{
star.disableBody(true, true);

score += 10;
scoreText.setText('Score: ' + score);

if (stars.countActive(true) === 0)
{
/* right now the end */
star.disableBody(true, true);

this.physics.pause();

player.anims.play('turn');
gameend = this.add.text(300, 200, 'Toll, geschafft!\n\nYour score: ' + score + '\n\nTap to share', { fontSize: '32px', fill: '#000' });
share = 1;
gameOver = true;

/* var test = (player.x < 400) ? Phaser.Math.Between(400, 800) : Phaser.Math.Between(0, 400);
stars.children.iterate(function (child) {
child.enableBody(true, (Phaser.Math.Between(150, 800)), 50, true, true);
}); */


var x = (player.x < 400) ? Phaser.Math.Between(400, 800) : Phaser.Math.Between(0, 400);

var bomb = bombs.create(x, 16, 'bomb');
bomb.setBounce(1);
bomb.setCollideWorldBounds(true);
bomb.setVelocity(Phaser.Math.Between(-200, 200), 20);


}
}

function collectGround (platforms, star)
{
star.disableBody(true, true);

this.physics.pause();

player.anims.play('turn');

/* if the game ends do this
later as function */

gameend = this.add.text(300, 200, 'Schade, nicht geschafft.\n\nYour score: ' + score + '\n\nTap to restart', { fontSize: '32px', fill: '#000' });
endgame = 1;




/* if (cursors.up.isDown)
{
location.replace("game.html")
} */


/* alert("Verloren");
gameOver = true; */
}



/* function collectGround (platforms, star)
{
star.disableBody(true, true);
score += 10;
scoreText.setText('Score: ' + score);
} */


function hitBomb (player, bomb)
{
this.physics.pause();

player.setTint(0xff0000);

player.anims.play('turn');

gameOver = true;
}








</script>

</body>



</html>
68 changes: 68 additions & 0 deletions img.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css?">
<title>Testseite</title>



</head>
<body>
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v10.0" nonce="ITCIPy1H"></script>

<h1 class="test-test">Bild</h1>






<div class="test-test">
<a href="#"><img class="smaller-image" src="https://cdn.discordapp.com/attachments/827113407048056892/828970194873352263/placeholderSharepic.png" alt="Theodor Fontana sagt das Birnen gesund sind."></a>
</div>

<div class="test-test">
<p class="nomargin"><input type="button" onclick="window.location.href='index.html'" value="Zurück"></p>
<!-- <p class="nomargin"><input type="button" onclick="window.open('http://www.github.com')" value="Spiel starten"></p> -->





</div>




<div class="test-test nospace">
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="test" data-url="https://cdn.discordapp.com/attachments/827113407048056892/828970194873352263/placeholderSharepic.png" data-hashtags="test-tweet" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>

<div class="fb-share-button" data-href="https://cdn.discordapp.com/attachments/827113407048056892/828970194873352263/placeholderSharepic.png" data-layout="button_count" data-size="small"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fcdn.discordapp.com%2Fattachments%2F827113407048056892%2F828970194873352263%2FplaceholderSharepic.png&amp;src=sdkpreparse" class="fb-xfbml-parse-ignore">Teilen</a></div>

<!-- <div>
<p class="test-test">Cat ipsum dolor sit amet, jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed. Go into a room to decide you didn't want to be in there anyway. I like big cats and i can not lie kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Meow i could pee on this if i had the energy for slap owner's face at 5am until human fills food dish yet scamper. Knock dish off table head butt cant eat out of my own dish scratch the furniture. Make meme, make cute face. Sleep in the bathroom sink chase laser but pee in the shoe. Paw at your fat belly licks your face and eat grass, throw it back up kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Attack feet behind the couch destroy couch flop over give attitude hide when guests come over hopped up on goofballs hunt anything that moves claw drapes, swat at dog bag stretch all of a sudden go crazy flop over shake treat make muffins, intently stare at the same spot chase mice intrigued by the shower inspect anything brought into the house stand in front of the computer screen lick butt flop over. Make muffins intrigued by the shower hunt anything that moves attack feet flop over destroy couch behind the couch, swat at dog hopped up on goofballs all of a sudden go crazy hide when guests come over inspect anything brought into the house intently stare at the same spot claw drapes, bag stretch flop over stand in front of the computer screen lick butt give attitude shake treat .</p>
</div>
<div class="test-test">
<h2>Zitat</h2>
<p class="rot">Mit diesen Worten ging er hin.</p>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-size="large" data-text="Mit diesen Worten ging er hin." data-url="https://camouflaged-penguin.github.io/website-test/" data-hashtags="test-tweet" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div> -->
<!-- <div>
<a href="game.html">Gameboxtest</a> - Link zur Gamebox
</div> -->

<!-- <div id="game">
<div id="character"></div>
<div id="block"></div>
</div> -->
<!-- <script src="script.js"></script> -->

</body>



</html>
Loading

0 comments on commit f3529b0

Please sign in to comment.