Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by MikeL

I updated the Director module so that it conforms to the lib/plugins standard. For those who aren't familiar, the Director plugin allows you to essentially create an array of levels which can be easily traversed using functions like nextLevel, previousLevel, jumpTo(levelDungeon), etc. You can also append new levels.

Director plugin

Once I'm finished with my current project, I'm hoping to add transitions between levels to this plugin.

1 decade ago by MobileMark

Love this module, can't wait for transitions.

1 decade ago by wavyGravy

I love your plugin but I'm having a bit of trouble generating entities every time I load a new level. Any help will be greatly appreciated.

1 decade ago by wavyGravy

Nevermind, I figured out why. I should lay off the crack. Thank you for such a great plugin.

1 decade ago by stahlmanDesign

I have a giant world map that's 7168 x 6912 pixels. That's 7x9 iPad screens. It's too big, and that makes it slow, so I was thinking of breaking it up into regions that would load like a new level. But since I want it to be seamless, I want to be able to transition to the new level at any horizontal or vertical point. That means when the new level is loaded, I want the character to start at a specific point depending on how he came in. It doesn't work to have one fixed starting point, because you can enter the level from many different directions.

How should I deal with this?

1 decade ago by MikeL

One possibility is to make a 2 dimensional array that contains the level info in each cell. You could then come up with an algorithm that predicts what will happen when the player moves to the edge of the screen. For example if they are at position [3,0] and they reach the extreme right of the screen, then they would advance to [4,0] (assuming [4,0] exists, if it doesn't then player is blocked) and so forth.

In this example [4,0] would contain the level name say 'Level4-0' or something more original and Director could jump to it. Then in the PlayerController referenced before, it would be aware of what direction the player left the previous screen so that it can place it in the right area of the new level Level4-0. It would also track where the player exists within the 2 dimensional array.

That's just a quick idea, may be much better ideas out there. Of course you could modify Director in a very big way to incorporate your sub-levels, but that would probably entail a lot more work.

1 decade ago by MikeL

As I think about it some more, Director would not be needed in the above example, just the standard .loadLevel to load in each individual grid portion (standard Impact level) of your "super level".

Of course you could instead use Director to load your "super levels" which would contain the 2x2 array referenced above. Each super level would be in it's own module just like each Impact level is in its own module.

1 decade ago by Jesse

This plugin needs to call "loadLevelDeferred" instead of "loadLevel" if a Level hasn't been loaded yet, because just calling "loadLevel" during a game's update function can make the game state get a little weird. So this plugin should have a method that determines which one to call, based upon if it's called "loadLevel" yet.

1 decade ago by MikeL

@Jesse: You are correct. There is a reference to that in the Readme. The plugin was created around the time the loadLevelDeferred method was instituted. So I have kept the original loadLevel function. Although now there have been enough updates to Impact that I really should upgrade loadLevelDeferred to be the default call. Thanks.

1 decade ago by JackImpact

Hi all,

I am stuck with this weird bug for two days now. All the efforts result no success. I hope any expert can help. I believe the problem is to do with the Director plugin. But not sure.

Basically I am developing a shooting game. There is an arrow in the game which can shoot bullets. The bullet shooting works as expected when the game is loaded for the first time. But If I bring up the menus by clicking a menu button and chose another level to play, the arrow doesn’t spawn a bullet at the first mouse click but spawn bullets on the subsequence clicks.

Besides the menu button, I also have a reload button and next level button. All these two buttons are working fine. When reloaded or going to the next level, the arrow’s behavior is perfect. Only this Menu button is not working.

When the menu button is clicked, it changes the game’s state to menu state and show the world choice menu on which you can choose the world, then choose a level in the world. Once the level button is clicked, the level choice menu is hidden and the level is loaded. Then the problem comes in. First click, no bullet.

Please note, I am using the Director Plugin by Boneheadmed (https://github.com/boneheadmed/Director) to manage the levels. The world choice menu and level choice menu is created using jquery and DOM elements.

Here are the relevant code snippets:
button click to hide the menu, change the game state and reset all the game variables

$("#btnPark1").click(

				function(){

				            $("#menuLevelsPark").hide();
							
							ig.game.gameStateInParkLevelMenu=false;
							




							ig.game.myDirector.loadLevel(0);
							ig.game.currentLevelVars = clone( ig.game.levelVars[ 0 ] );
							
							ig.game.generateBtnAndMenu();
							
							
							ig.game.lives=ig.game.livesB+ig.game.currentLevelVars.lives;
							ig.game.powerUpNum=ig.game.powerUpNumB+ig.game.currentLevelVars.powerUpNum;
							ig.game.iceCreamNum=ig.game.iceCreamNumB+ig.game.currentLevelVars.iceCreamNum;
							ig.game.archNum=ig.game.archNumB+ig.game.currentLevelVars.archNum;

							

							ig.game.gameTimer.reset();
					     }

			);

Arrow to shoot bullet

EntityArrow=ig.Entity.extend({
		
		   animSheet: new ig.AnimationSheet( 'media/arrowSpace.png', 50, 100 ),
		   size: {x: 50, y:100},
		   offset: {x: 0, y: 0},
		   flip: false,
		   zIndex:300,
		   aPaused:false,
		   name:'arrow',
		   //weapon:'splat',
		   weapon:'bullet',
		   alphaFactor:0,
		   collides: ig.Entity.COLLIDES.NEVER,
		   //checkAgainst: ig.Entity.TYPE.B,
		   
		   init: function( x, y, settings ) {
				this.parent( x, y, settings );
				this.addAnim( 'idle', 1, [0] );
				
				},
		   
		   update:function(){
			   
			  if(ig.input.pressed('shoot')){
						
						console.log('arrow paused:'+this.aPaused);
						}
			   
			   if(!this.aPaused){
					x = this.pos.x+this.size.x/2;
					y = this.pos.y+this.size.y;
					mx = ig.input.mouse.x;
					my = ig.input.mouse.y;
					
					this.alphaFactor+=Math.PI/180;
					if(this.alphaFactor>Math.PI){
						this.alphaFactor=0;
						}
					shootingAngle=Math.atan2((my-y),(mx-x))+Math.PI/2;
					
					this.anims.idle.pivot={x:25,y:100};
					this.anims.idle.angle=shootingAngle;
					this.anims.idle.alpha=0.2+Math.sin(this.alphaFactor);
					
					//console.log(this.anims.idle.alpha);
					 if(ig.input.pressed('shoot')){
						console.log("inner shoot");
						}
					
					
				
				   if( ig.input.pressed( 'shoot' )&&ig.game.getEntitiesByType(EntityBullet).length==0&&ig.game.getEntitiesByType(EntityBulletLittle).length==0){
				
					   
					  // console.log("shootPressed: "+ig.input.pressed('shoot'));
					 //  console.log("powerUpClickNum: "+ig.game.powerUpClickNum);
					  // console.log("BulletNum: "+ig.game.getEntitiesByType(EntityBullet).length);
					  // console.log("LivesNum: "+ig.game.lives);
					   
					  
					   if(this.weapon==='bullet'){
							
							if(ig.game.lives>0){
							//ig.game.spawnEntity(EntityBullet,330,355);
							ig.game.spawnEntity(EntityBullet,335,380);
							//ig.game.spawnEntity(EntityIceCream,this.pos.x,this.pos.y);
							//ig.game.spawnEntity(EntityBullet,this.pos.x,this.pos.y);
							}
		
						}
						
						else if(this.weapon==='powerUp'){
							if(ig.game.powerUpNum>0){
						      ig.game.spawnEntity(EntityPowerUpW,335,380);
							 }
							
						}
						
						else if(this.weapon==='splat'){
							if(ig.game.archNum>0){
							//alert('splat');
							ig.game.spawnEntity(EntityPowerUpM,335,380);	
							}
						}
						
						//else{
//							return;	
//						}
						
						
					
				   }
				   
				  
				   }//end of paused condition
				   		   
			 		this.parent();
			  },
		   
		});


Any hero can help to find this monster bug?
Page 1 of 1
« first « previous next › last »