Yupoong

Members
  • Content Count

    6
  • Joined

  • Last visited

About Yupoong

  • Rank
    Newbie

Recent Profile Visitors

523 profile views
  1. Yupoong

    Animation or emitter?

    Dear readers, I want to ask a question about Phaser, if my enemy gets killed I want to start a blood animations (spritesheet) , I tried to put it in my collisionHandler where my bullet and enemy die but this doesn't work. On phaser itself I found emitters but i'm not great with that, so if someone could help me understand the logic that would be great Thanks, Yupoong
  2. Yupoong

    Struggling with some things

    Ok 1) I got it 2) you just do: game.state.add('gameState', gameState) And then you do : game.state.start('gameState') And then it will start gameState
  3. Yupoong

    Struggling with some things

    Ok so first of all thank you for your reply, i try to understand everything you say so i'm gonna ask some things to clear it if that's ok. 1) I'm gonna write a short code with your code here so i can put it into my code to know if everything is on the right place: var gameState = { preload: function(){ } create: function(){ spawnEnemies(); } update: function(){ } function spawnEnemy (x) { var sprite= game.add.sprite(x, y, 'enemysheet'); sprite.scale.setTo(3); enemies.add(sprite); sprite.animations.add('walk'); sprite.animations.play('walk', 20, true); setTimeout(function () { sprite.body.velocity.y = 100; }, Math.random() * 1000); } function spawnEnemies () { for (var i =0 ;i < 800 / 40 ;i++) { spawnEnemy(20 + (i * 170), 32); } } I think you mean this with your code, i just put your code like this and call it in the create? Also it creates sprites at a random time or how fast will it go? 2) This part is hard to understand, I understand what you mean with your functions so i can make a new state like: var level1State = { preload: function(){ }, create: function(){ spawnEnemies(); }, update: function(){ }, } function spawnEnemy (x) { var sprite= game.add.sprite(x, y, 'enemysheet') sprite.scale.setTo(3) enemies.add(sprite) sprite.animations.add('walk') sprite.animations.play('walk', 20, true) setTimeout(function () { sprite.body.velocity.y = 100 }, Math.random() * 1000) } function spawnEnemies () { for (var i =0 ;i < 800 / 40 ;i++) { spawnEnemy(20 + (i * 170), 32) } } With the same code, well the changes of the enemies ofcourse? and then run the level1 after my mainmenuState ? I'm a beginner in javascript and phaser so i'm really trying to understand you haha, thanks for the help by the way.
  4. Yupoong

    Struggling with some things

    Hello readers and helpers, I am working quite a lot on my game but I struggle with some things like: 1) I spawn my enemies in 5rows from the top to the bottom and they also walk down already. My problem is that they spawn with 5 and go down with 5 at the same time, I want that the enemies spawn at a different time (random time) The code that I used to spawn 5enemies in a row at the top and let them walk down. for (var i =0 ;i < 800 / 40 ;i++) { var sprite= game.add.sprite(20 + (i * 170), 32,"enemysheet"); sprite.scale.setTo(3); enemies.add(sprite); var walk = sprite.animations.add('walk'); sprite.animations.play('walk', 20, true); sprite.body.velocity.y = 100; } 2) My second problem is that when 5 enemies are killed that I want to go to a new level where more enemies will come. But how do i do this? (With new states with all my code and changes for the more enemies ?) ---> This doesn't look clean I think ----------------------------------------------------------------------------------------------------------------------------------------- Thank you for helping in advance guys, I appreciate it.
  5. Yupoong

    School Project , new to Phaser

    Yeah I like what you suggest there, but how can they come in the screen? by putting the positon of Y higher? And i don't really know what you mean with the restful API. And indeed the shooter already shoots to the top, there are 3 enemies that are on position, but not when a timer starts or something, and my collision doesn't work yet .. I need a lot more but even the basic is hard
  6. Yupoong

    School Project , new to Phaser

    Dear readers, I have a problem, well not a problem, but I need help. At first I want to say that English is not my main language and if I make mistakes you should correct me. I'm also new to phaser and programming, but I am willing to learn. So for school i need to make a game linked with a database (login, score, money) on a website. What I was thinking is some kind of Plants VS Zombies, but then with 1shooter at the bottom, move him sideways to kill the zombies and try to keep them away from the under border. What I have already is the background, the moving "soldier" and that he can shoot. I also have an enemy sprite but for some way he doesn't want to load ... . I don't know how to spawn the enemies in like 5 /6 lines from top. And that they will walk down, like LEVEL1: kill 5 zombies LEVEL2: kill 10 , and each level you earn money for more damage, but the zombies will become better and better. So it would be a great help if somebody could explain this for me, not only in code but also in words, like I said i'm new in coding and want to learn. In the attachment you will find a zip of my game, my main language is DUTCH, so the commentaries are in DUTCH, but my code is in English. If i need to explain something i wrote, just ask :)! Thanks for everyone who wants to help! I'll try to answer as soon as possible ! STAY CODING AND LEARNING !! PhaserCode.rar