
goide
Members-
Posts
55 -
Joined
-
Last visited
Everything posted by goide
-
Watch the video, if I miss these lines of code, the bullet starts from zero. What this does is update the bullet pocision, where is the enemy. look: https://db.tt/BMdB0BL8
-
This is my result. Otherwise, only the last enemy shoots screen, the above does not fire. My class game.Disparar. game.createClass('Disparar', { init: function(){ this.bodyBala = new game.Body(); this.bodyBala.collisionGroup = 5; this.bodyBala.velocity.set(10,10); this.bodyBala.collideAgainst = [0,3]; for(var i=0; i<game.scene.enemigosRazo.length; i++){ this.bodyBala.position.set(game.scene.enemigosRazo[i].sprite.position.x, game.scene.enemigosRazo[i].sprite.position.y); } this.bodyBala.collide = this.colisionBarricada.bind(this); this.bala = new game.Sprite('bala.png'); this.bala.anchorCenter(); this.bala.addTo(game.scene.contenedor); var shape = new game.Circle(this.bala.width, this.bala.height); this.bodyBala.addShape(shape); this.bodyBala.addTo(game.scene.world); }, removeBala: function(){ this.bodyBala.remove(); this.bala.remove(); game.scene.removeObject(this); }, update: function(){ this.bala.position.copy(this.bodyBala.position);//Update position bullet } });You speak Spanish?
-
My Code. Class EnemigoRazo game.createClass('EnemigoRazo',{ vida: true, init:function(x,y){ this.cuerpoEnemigo = new game.Body(); this.cuerpoEnemigo.collisionGroup = 7; this.cuerpoEnemigo.position.set(x,y); this.cuerpoEnemigo.collideAgainst = [0]; this.sprite = new game.Sprite('enemigo.png'); this.sprite.anchorCenter(); this.sprite.position.set(x,y); this.sprite.visible = false; this.sprite.addTo(game.scene.contenedor); this.animateSprite = new game.Animation([ 'enemigo/enemigoRun-0.png', 'enemigo/enemigoRun-1.png', 'enemigo/enemigoRun-2.png', 'enemigo/enemigoRun-3.png', 'enemigo/enemigoRun-4.png', 'enemigo/enemigoRun-6.png', 'enemigo/enemigoRun-7.png', 'enemigo/enemigoRun-8.png', 'enemigo/enemigoRun-9.png' ]); this.animateSprite.addAnim('correr',[0,1,2,3,4,3,2,1,0,5,6,7,8,7,6,5,0],{speed:7}); this.animateSprite.width = 40; this.animateSprite.height = 19; this.animateSprite.anchorCenter(); this.animateSprite.position.set(x,y); this.animateSprite.addTo(game.scene.contenedor); this.animateSprite.play('correr'); var shape = new game.Rectangle(this.sprite.width,this.sprite.height); this.cuerpoEnemigo.addShape(shape); this.cuerpoEnemigo.addTo(game.scene.world); this.enemigoCorriendo(); game.scene.addTimer(400, this.disparaEnemigo.bind(this), true); }, enemigoCorriendo: function(){ game.scene.balaBuscaSoldado(this.cuerpoEnemigo,game.scene.sprite,20,0); }, removeAnimation: function(){ this.animateSprite.remove(); }, disparaEnemigo: function(){ this.balas = new game.Disparar(); this.balas.rotation = game.scene.balaBuscaSoldado(this.balas.bodyBala,game.scene.sprite,300,0);//The bullet seeking the position of my hero. }, update: function(){ this.animateSprite.position.copy(this.cuerpoEnemigo.position); this.sprite.position.copy(this.cuerpoEnemigo.position); } });This is my enemy class and this works, as you see in the video.
-
Try as you explained to me. My enemy class, add the eBullet method, and this method has a timer calls. Ok, my main.js file and call the class enemy as you indicate me in your example. look at the video, I still have the same result. when an enemy is added, the previous stop shooting. Video: https://db.tt/xlo4Xlyq
-
Thank you very much for your answer, but look and achieve my goal. look this is my function, is the angle of my two objects, and my mistake was that it was not updated each positioned himself as the animation was moving. anguloEntre: function(source, target){ var dx = target.x - source.x; var dy = target.y - source.y; return Math.atan2(dy, dx); }
-
A question. I need to rotate an animation, in the direction of another object. Create a method that allows me to do this. but for a sprite, but when I try to type an object animation, but does not rotate. watch the video, which have two methods, which are angles to me to turn my animation, you work to perfection and the other not. Video: https://db.tt/f01HXSmj Look how the sprite with the same angle, pointing to my hero. and when I use the animation with the same angle and not pointing to it. and when I change the method by spinning according to the pointer, rotating smoothly. the animation changes its angle to the method I use for the angle of the pointer, but the method if it works, to change the angle for the sprite. but to change the angle of the animation is not working. why?
-
Yes, I thought that, that every time a new enemy called, acts as if you were creating a new object, and returns and calls the two methods. why not keep shooting the former enemy. I thought of all the enemy build through an array and cross it with a for loop. instead of using the timer. Can you help me how to build what you're saying.
-
The problem is as described in the following video. https://db.tt/NAvsrdVD I have two timers, one to generate a new enemy. and the other to generate the shot. this.addTimer(3000, this.addEnemy.bind(this), true); //Call method for generate enemysthis.agregarEnemigo(); //update rotation angle for enemythis.addTimer(400, this.eBullets.bind(this), true);addEnemy: function(){ this.enemigo = new game.Enemigo(game.width.random(), game.height.random()); //call class enemy}eBullets: function(){ if(this.enemigo.life === true){ this.enemigo.Shoot(); } }This is my code to work as this in the video. The goal is to generate enemies and shoot them my hero. So far the problem that I have is that when you build the next enemy. the former enemy stops shooting. And I want to shoot the enemies simultaneously.
-
amazing game.
-
I uploaded my game to a server, and the browser on my laptop see the game, income from the iphone and I see nothing. As I set to work on my iphone? Thanks.
-
Camera issue. https://github.com/ekelokorpi/panda.js-engine/issues I think that is not working properly at all at the moment.
- 5 replies
-
- panda.js
- vertical scroll
-
(and 1 more)
Tagged with:
-
@oranjoose When you download this development version, create the media folder, in this folder copy the image or sprite. whatever you want to call, and then you try it as this in the playground. Watch this video, and examples of the playground: https://db.tt/bg6FnqFD
-
@PixelPiconSean Hi, good afternoon, I have a question. I'm doing this example I've seen Phaser. http://phaser.io/examples/v2/arcade-physics/shoot-the-pointer Video Phaser ( https://db.tt/uYEYUFnz ) vs My video Panda ( https://db.tt/By422o5t ), These two are the results. Although my example is Panda doing the same, Although my example is Panda doing the same, and for this you need a little help. These methods are the missing add. they are Phaser. bullets.createMultiple(50, 'bullet'); // Creates multiple Phaser.Sprite objects and adds them to the top of this group. -> https://github.com/photonstorm/phaser/blob/v2.3.0/src/core/Group.js#L423var bullet = bullets.getFirstDead(); // Get the number of dead children in this group. -> https://github.com/photonstorm/phaser/blob/v2.3.0/src/core/Group.js#L1709The first method would help me create multiple sprite of bullets. that by the time my example, for every click (mousedown), shoot only one bullet. the solution is that it would put a for loop, as the method (createMultiple), but all the bullets fired at the same time. does not like phaser, firing one at a time, not simultaneously. The second method, help me count the bullets disappear from the screen. (I mean the size of the width and height of the canvas). and would be given by dead, that is to remove the object. As I can implement these methods? Look at my code: mousedown: function(){ this.sprite.shoot();}When you click, call shooting method, This method performs this: shoot: function(){ this.bullets = new game.Disparo(); game.scene.moverPointer(this.bullets.bodyBullet, 300, 0); //This method gives the direction of the bullets when fired. It is running fine.}Ok, this is the method of fire or shot. having phaser. in that example. function fire() { if (game.time.now > nextFire && bullets.countDead() > 0) { nextFire = game.time.now + fireRate; var bullet = bullets.getFirstDead(); //I am missing method implement. bullet.reset(sprite.x - 8, sprite.y - 8); game.physics.arcade.moveToPointer(bullet, 300); //works for my example }}Andd this second method, which I include in my shot method. since in Phaser they not included in the Fire method, but in my example when I press click (mousedown). I'll make the call to shoot me how many bullets I want. bullets.createMultiple(50, 'bullet');It would be helpful if I could explain this a bit. Thank you.
-
@oranjoose My test, TilingSprite works. Panda engine 2.0.0 (dev version)
-
@oranjoose look at the following: http://ekelokorpi.github.io/panda.js-site/engine/playground/#tilingsprite_basic
-
My mistake was I was looking pointer coordinates in the window. and I reread again the code and the coordinates I have to look at the canvas. mousemove: function(x,y,heroe,e){ this.dx = e.canvasX; //Canvas coordinate X this.dy = e.canvasY; //Canvas coordinate Y }, anguloPuntero: function(objeto){ return Math.atan2((this.dy - objeto.position.y),(this.dx - objeto.position.x)); }, update: function(){ this.sprite.rotation = this.anguloPuntero(this.sprite); }I changed a little code, but is the same.
-
I need to rotate a sprite, according to the pointer. Phaser has the following code to do this. angleToPointer: function (displayObject, pointer) { pointer = pointer || this.game.input.activePointer; var dx = pointer.worldX - displayObject.x; var dy = pointer.worldY - displayObject.y; return Math.atan2(dy, dx);}Given this code, and reviewing the Class Vector in panda.js 2.0. In documentacionhe it is seen that has two methods which are: angle and angleFromOrigin. angleFromOrigin: function(vector) { return Math.atan2(vector.y, vector.x) - Math.atan2(this.y, this.x);} //This method is very similar to Phaser.which try to access them and have failed. in the following way game.vector.angleFromOrigin()I could not access because this method. the easiest way to recreate the phaser method.It is on the scene in the mousemove add the following method. mousemove: function(x,y,id,e){ var dx = e.x - this.sprite.position.x; //Took the pointer value in x, and rest with the last posision x, just like the method is doing phaser. var dy = e.y - this.sprite.position.y; this.giro = Math.atan2(dy,dx); this.sprite.rotation = this.giro;},Ok, the sprite makes its rotation. but not rotate with the movement of the pointer.
-
@enpu In the end I finished reading the camera.js class, to make it work. I understood many things, and I managed to work, hmm but a little flawed. To make it work, create a container where the objects would be captured would create, that is a general container. sprite has its own container and container text and added them to the general sprite container. this.camera = new game.Camera();this.camera.addTo(this.contenedorMundo); //Main container, is assumed that this should be the stage.this.camera.offset.set(game.width / 3, game.height / 2);this.camera.minX = 0; this.camera.minY = 0;this.camera.maxX = 2800; this.camera.maxY = 1800;this.camera.setSensor(10,10);this.camera.setTarget(this.contenedor); //Container sprite.I doubt this genre. if in a scene the stage is a container, I had to create one for it to work the camera. And the other as you can see in the video, the camera moves either to the right and down, but the left and top do not function. ( https://db.tt/iUVXgXTA )
-
Great Work
- 12 replies
-
- video game
- game music
-
(and 8 more)
Tagged with:
-
@enpu I'm trying to accomplish this example: http://phaser.io/exa...ra/basic-follow http://vermeire.home.xs4all.nl/panda/fiddler.html, In the examples of the fiddler, I saw an example of using the camera in panda. Ok watching these videos, I think it will help you understand a little. urrently the example in the fiddle, can only do this. ( https://dl.dropboxusercontent.com/u/62623895/Images/camera%20test/fiddle-1.webm ) Modify it and add a line of code, and reach that work like the example I want to make. the example is made of phaser. ( https://dl.dropboxusercontent.com/u/62623895/Images/camera%20test/fiddle-3.webm ) Ok when all good, but I'm working with the development version panda engine 2.0.0. In this video, my code works as it is the code on the fiddle. to be more clear as the first video. ( https://dl.dropboxusercontent.com/u/62623895/Images/camera%20test/tests-1.webm ) As you saw in the second video, just add the line of code to add the camera to the scene, in my video I make the same.but it does not work, stop working even.watch the video. ( https://dl.dropboxusercontent.com/u/62623895/Images/camera%20test/test-2.webm ). Well, so far as you can see me the code does not work, do not know why. but as you see, I worked as it was the first video. Now this last line, which have added, in the second line, look at the video. ( https://dl.dropboxusercontent.com/u/62623895/Images/camera%20test/test-3.webm ) now it works as it is the example in the fiddle and the first video. but it does not work the way I want it to work. the question is that if the code is the same, but is not working. and if you help me in this small, and that is the last part that I need to put to work the camera. this is my code VS the code example of the fiddle My code ( https://db.tt/mjeKLH0K ), Example Fiddle ( https://db.tt/Umnn20hn ) Thanks for your help.