• Content Count

  • Joined

  • Last visited

About phuurup

  • Rank
  • Birthday April 1

Profile Information

  • Gender
    Not Telling
  1. dthayes! thanks for all your help. I enabled the body and put the function that calls the jumping in the update function and it works! I was about to erase it all and start from scratch, thanks again!!
  2. Awesome, thanks for replying drhayes! I'll look into all of that right now.
  3. I tried searching for a reason but the inspector says 'Uncaught TypeError: Cannot read property 'touching' of undefined', how should I work around or correct this? jumpFun: function() { if( this.physics.arcade.collide( this.hero, this.platforms )) { this.normalBounce(); } else if (this.physics.arcade.collide( this.hero, this.special )) { this.specialBounce(); } }, normalBounce: function() { if( this.hero.body.touching.down ) { this.hero.body.velocity.y = -350; } }, specialBounce: function(){ if( this.hero.body.touching.down ) { this.hero.body.velocity.y = -750; } },
  4. I feel like I should incorporate the special jump with the player movement. Does anyone have any comments about that? playerMove: function() { if( this.cursor.left.isDown ) { this.player.body.velocity.x = -300; } else if( this.cursor.right.isDown ) { this.player.body.velocity.x = 300; } else { this.player.body.velocity.x = 0; } // handle player jumping if( this.player.body.touching.down ) { this.player.body.velocity.y = -350; } else if ( this.player.body.touching.specialPlatform) { this.hero.body.velocity.y = - 700; } Or should i redesign the code so that playerMove just moves the player left and right, while the actual collision between player and platform determines the value of the y velocity? I'm also looking threw the Phaser.Physics.Arcade.Body API right now. thoughts, ..anyone?
  5. Hey, I'm trying to get the player to jump different heights based on what he's jumping on. I tried: Within the players 'move' function saying (in point form) if(touching down)vel.y = -350 else if (this touching special platform) el = -700, and the player only bounces -350. I also tried creating a function so when the player and platform overlap and collide, it'd call this new height, but that didn't work either. Has anyone came across the same problem before, if so how did you solve it. Or would anyone know an example of how to solve this problem. ps: I'm brushing up on my logic/Javascript so hopefully my n00b questions will soon disappear. thanks for any help in advance.
  6. Post the code! it's probably something else in combination to the overlap/collide issue you're having.
  7. Oh, ya. Realized what I was talking about were "groups". anyone who has seen any of my previous questions can guess; no, no I am not a programming student/professional. Just find this very interesting.
  8. Hey, I'm trying to practice the phaser framework (and programming in general) by trying to recreate a doodle jump/papi jump game. I have the little ball jumping, enemy on the screen with collision detection and all the platforms being recycled once they die, however I have not been able to recycle (or even place) my enemies on the platforms. Because the platforms are not fixed I can't simply say ( x, y) cause the platform won't always be there. I tried: enemy = game.add.sprite( game.platform.centerX, game.platform.centerY, 'enemy' ); but to no avail. Am I on the right track? or not even close? Has anyone ever had the same problem and just overcome it in a different way, like creating a platform with an enemy on it by itself, and that entire sprite being its own class that's called on via a timer delay? Hopefully this is not too n00by of a question. Tips or directing me to resources are all helpful. Just trying to kill my 'hero', guys(and gals).. thanks again!
  9. I think what you're looking for is: this.physics.arcade.collide( this.myShoots, this.asteroids); //put this in your update function (will differ if you're using stages/states) and then you'll have to define the 'myShoots' function and the "asteroids" function just bellow your update function, before your closing }; . I hope this is what you were looking for! Play around with your code. it seems like it's 10% "coding" 90% debugging haha.. lol my bad: this.physics.arcade.collide( this.myShoots, this.asteroids); //this will make them collide this.physics.arcade.overlap( this.myShoots, this.asteroids, this.die, null, this); //so this says when the shot and the astroid collide execute the third parameter "die". don't forget to make the functions!
  10. Took me a second to understand (cause i didn't read the instructions ..i'm a male), but then 30 mins felt like 5! Awesome game!
  11. After going through other peoples code, i've figured it out! Thank you to the two individuals who commented, and to the other 159 (at this point) individuals who just looked at this and said "I'll let the next guy answer this one #n00b". joke directed towards myself**
  12. Even when I blindly copy and paste it doesn't seem to work. I'm using brackets and it's live preview option. Could that Just be the issue? :\ thanks again everyone. I know it might be something small, but I'm just learning this Code if anyone cares: <!DOCTYPE html><html><head> <meta charset="utf-8" /> <title>practice</title> <script type="text/javascript" src="lib/phaser.js"></script> <script type="text/javascript" src="main2.js"></script></head><body> <div id="gameDiv"></div> </body> </html>______________________________________________________________________________________________ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameDiv'); function preload() { game.load.image('ground', 'images/PNG/red_button00.png'); game.load.image('ball', 'images/PNG/green_circle.png'); }, var sprite; var sprite2; function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#124184'; sprite = game.add.sprite(50, 200, 'ground'); sprite2 = game.add.sprite(700, 220, 'ball'); game.physics.enable( [ sprite, sprite2 ], Phaser.Physics.ARCADE); = 'ground'; sprite.body.velocity.x = 100; = 'ball'; sprite2.body.velocity.x = -100; } function update() { // object1, object2, collideCallback, processCallback, callbackContext game.physics.arcade.collide(sprite, sprite2, collisionHandler, null, this); } function collisionHandler (obj1, obj2) { // The two sprites are colliding game.stage.backgroundColor = '#992d2d'; } function render() { game.debug.body(sprite); game.debug.body(sprite2); }