1 decade ago by paulh
Hi All
Im a bit confused (and a noob at coding) but ive tried to make a main menu page using entities as the menu items ... then spawn particles on a ,mouse press, the particles will then collide with the menu item to select it.
I knwo this works cos its in the core gameply but when i tried to make a menu not only does the frame rate drop massivly but i also dont see the particles. Im guessing it has something to do with the way i structured my code but i cant seem to work it out :-(
Im a bit confused (and a noob at coding) but ive tried to make a main menu page using entities as the menu items ... then spawn particles on a ,mouse press, the particles will then collide with the menu item to select it.
I knwo this works cos its in the core gameply but when i tried to make a menu not only does the frame rate drop massivly but i also dont see the particles. Im guessing it has something to do with the way i structured my code but i cant seem to work it out :-(
Menu = ig.Game.extend({ font: new ig.Font( 'media/blue.font.png' ),//font MenusImage:new ig.Image('media/been.png' ),//define intro image update: function() { ig.input.bind( ig.KEY.MOUSE1, 'mouseLeft' ); ig.game.spawnEntity(EntityStats,0,0);//spawn the game stats var mx = ig.input.mouse.x ; //Figures out the x coord of the mouse in the entire world var my = ig.input.mouse.y; //Figures out the y coord of the mouse in the entire world if (ig.game.menu == 0){ //console.log(ig.game.menu); this.loadLevel( LevelTest );// LOAD LEVEL DATA ig.game.spawnEntity(EntityMenu,22 ,46, { blockType:"Match" });//spawn a menu item ig.game.spawnEntity(EntityMenu,180 ,16, { blockType:"Free" });//spawn a menu item ig.game.spawnEntity(EntityMenu,342 ,46, { blockType:"Story" });//spawn a menu item ig.game.spawnEntity(EntityMenu,12 ,200, { blockType:"Options" });//spawn a menu item ig.game.spawnEntity(EntityMenu,180 ,192, { blockType:"Time" });//spawn a menu item ig.game.spawnEntity(EntityMenu,340 ,200, { blockType:"Level" });//spawn a menu item } ig.game.menu ==1; this.parent(); myGameMode = 5; }, run: function(){ if (ig.input.state('mouseLeft')) { ig.game.spawnEntity( FireGib, mx,my ); } this.parent(); } });