• Content count

  • Joined

  • Last visited

About espace3d

  • Rank
    Advanced Member
  1. hi, i'm searching to simplify my code and use a lot of possible the reuse principle. but in this case i don't see how could i do to achieve that . Any suggestions ? thanks. var logic_position=function(sprite){ if (debug_position){ console.log("retablissement des param├Ętres") hero.grid.visible=false var _table var _name_json switch({ case 'canon': _table=c _name_json='canon' console.log('sprite.angular',sprite.angular,_name_json) //var sprite.number=sprite.number _table[sprite.number] = { number:sprite.number, delay:sprite.delay, x:sprite.x, y:sprite.y, speed:sprite.speed, frequency:sprite.frequency, variance:sprite.variance, angular:sprite.angular, _flag:sprite._flag, kill_with_world:sprite.kill_with_world, special_color:sprite.special_color, }; break //asteroid = function(posx,posy,speed,radius) case 'asteroid': _table=a _name_json='asteroid' _table[sprite.number] = { x:sprite.x, y:sprite.y, speed:sprite.speed, radius:sprite.radius, }; break //neon = function(delay,posx,posy,speed,posx_in_tween) case 'neon': _table=n _name_json='neon' _table[sprite.number] = { delay:sprite.delay, x:sprite.x, y:sprite.y, speed:sprite.speed, posx_in_tween:sprite.posx_in_tween, }; break // //pulsar = function(delay,time,posx,posy,speed,scale_factor) case 'pulsar': console.log('', console.log(sprite.x) _table=p _name_json='pulsar' _table[sprite.number] = { delay:sprite.delay, time:sprite.time, x:sprite.x, y:sprite.y, speed:sprite.speed, scale_factor:sprite.scale_factor, }; break case 'dalle': _table=d _name_json='dalle' _table[sprite.number] = { delay:sprite.delay, x:sprite.x, y:sprite.y, speed:sprite.speed, }; break } localStorage.setItem(_name_json+sprite.number+'lev0', JSON.stringify(_table[sprite.number])); } }
  2. hi, if i use the arc and i would update the endAngle how do you do ? i try with a loop but it lag a lot. it seems that it redraw a new arc each time.. thanks. function create() { var graphics =,; graphics.lineStyle(0); graphics.beginFill(0xFF3300); //posx,posy,radius,startAngle,endAngle,clockwise graphics.arc(-100, -100, 135, game.math.degToRad(0), game.math.degToRad(90), true); graphics.endFill(); }
  3. thanks i play with particle.on=true or false to emit or not so.
  4. Nobody ?
  5. hi, I would use a special effect with my prototype weapon. this special effect is : some particles when the weapon fire. concern the lines : this.animate_when_fire() this.frequency,this.animate_when_fire,this ) When is use the function animate_when_fire with a loop, after a certain delay my game lag a lot. However i use only 3 particle each time of frequency (+/- 200ms). I use the same process for my other particles and i don't see any lag... what i'm doing wrong ? thanks for the assist _canon = function(delay,posx,posy,speed,frequency,variance,angular,_flag,kill_with_world){ this.delay=delay this.posx=posx this.posy=posy this.speed=speed this.frequency=frequency this.variance=variance this.angular=angular this.kill_with_world=kill_with_world this._flag=_flag this.flag_for_fire=true this._flag=true //canon,game,this.posx,this.posy,'canon') this.angle=this.angular this.animate_when_fire() this.frequency,this.animate_when_fire,this ) game.physics.arcade.enable(this); this.weapon=game.add.weapon(9,'bullet') if(this.kill_with_world){ this.weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS; }else{ for (var i = 0; i < 9; i++) { this.weapon.bulletCollideWorldBounds=true this.weapon.bullets.children[i].body.bounce.setTo(1,1) } } // Because our bullet is drawn facing up, we need to offset its rotation: this.weapon.bulletAngleOffset = 0; // The speed at which the bullet is fired this.weapon.bulletSpeed = this.speed; // Speed-up the rate of fire, allowing them to shoot 1 bullet every 60ms this.weapon.fireRate = this.frequency ; // Add a variance to the bullet angle by +- this value this.weapon.bulletAngleVariance = this.variance; // Tell the Weapon to track the 'player' Sprite, offset by 14px horizontally, 0 vertically this.weapon.trackSprite(this,0,0,true); this.delay,function(){this._flag=false},this ) } _canon.prototype = Object.create(Phaser.Sprite.prototype) _canon.prototype.constructor = _canon _canon.prototype.update = function(){ if(this._flag==false && this.flag_for_fire){ } } = function() { this.flag_for_fire=true this.weapon.fireRate = this.frequency ; this.weapon.bulletSpeed = this.speed; this.angle=this.angular this.weapon.bulletAngleVariance = this.variance; } _canon.prototype.animate_when_fire = function() { if(this.visible){ this.particlex = game.add.emitter(this.x+35,this.y) this.particlex.makeParticles("particle_canon") this.particlex.minParticleSpeed.setTo(100,-190) this.particlex.maxParticleSpeed.setTo(500,240) this.particlex.setAlpha(.4, .1) this.particlex.minParticleScale = .4 this.particlex.maxParticleScale = .7 this.particlex.minRotation = 0 this.particlex.maxRotation = 0 this.particlex.on=false this.particlex.start(true,200,null,3) } }
  6. Is the collision detection with group better in term of performance ?
  7. Hi, I follow this library : <html> <head> <script type="text/javascript" src="cordova.js"></script> </head> <body> <script> var appId = "4f7b433509b6025804000002"; var appSignature = "dd2d41b69ac01b80f443f5b6cf06096d457f82bd"; /* var appId; var appSignature; //android if (navigator.userAgent.match(/Android/i)) { appId = "4f7b433509b6025804000002"; appSignature = "dd2d41b69ac01b80f443f5b6cf06096d457f82bd"; } //ios else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) { appId = "4f21c409cd1cb2fb7000001b"; appSignature = "92e2de2fd7070327bdeb54c15a5295309c6fcd2d"; } */ document.addEventListener("deviceready", function(){ window.chartboost.setUp(appId, appSignature); // window.chartboost.onInterstitialAdPreloaded = function(location) { alert('onInterstitialAdPreloaded: ' + location); }; window.chartboost.onInterstitialAdLoaded = function(location) { alert('onInterstitialAdLoaded: ' + location); }; window.chartboost.onInterstitialAdShown = function(location) { alert('onInterstitialAdShown: ' + location); }; window.chartboost.onInterstitialAdHidden = function(location) { alert('onInterstitialAdHidden: ' + location); }; // window.chartboost.onMoreAppsAdPreloaded = function(location) { alert('onMoreAppsAdPreloaded: ' + location); }; window.chartboost.onMoreAppsAdLoaded = function(location) { alert('onMoreAppsAdLoaded: ' + location); }; window.chartboost.onMoreAppsAdShown = function(location) { alert('onMoreAppsAdShown: ' + location); }; window.chartboost.onMoreAppsAdHidden = function(location) { alert('onMoreAppsAdHidden: ' + location); }; // window.chartboost.onRewardedVideoAdPreloaded = function(location) { alert('onRewardedVideoAdPreloaded: ' + location); }; window.chartboost.onRewardedVideoAdLoaded = function(location) { alert('onRewardedVideoAdLoaded: ' + location); }; window.chartboost.onRewardedVideoAdShown = function(location) { alert('onRewardedVideoAdShown: ' + location); }; window.chartboost.onRewardedVideoAdHidden = function(location) { alert('onRewardedVideoAdHidden: ' + location); }; window.chartboost.onRewardedVideoAdCompleted = function(location) { alert('onRewardedVideoAdCompleted: ' + location); }; }, false); /* location parameter: 'Default' - Supports legacy applications that only have one "Default" location 'Startup' - Initial startup of game. 'Home Screen' - Home screen the player first sees. 'Main Menu' - Menu that provides game options. 'Game Screen' - Game screen where all the magic happens. 'Achievements' - Screen with list of achievements in the game. 'Quests' - Quest, missions or goals screen describing things for a player to do. 'Pause' - Pause screen. 'Level Start' - Start of the level. 'Level Complete' - Completion of the level 'Turn Complete' - Finishing a turn in a game. 'IAP Store' - The store where the player pays real money for currency or items. 'Item Store' - The store where a player buys virtual goods. 'Game Over' - The game over screen after a player is finished playing. 'Leaderboard' - List of leaders in the game. 'Settings' - Screen where player can change settings such as sound. 'Quit' - Screen displayed right before the player exits a game. */ </script> <!-- static interstitial, video interstial --> <p><button onclick="window.chartboost.preloadInterstitialAd('Default');">preloadInterstitialAd</button></p> <p><button onclick="window.chartboost.showInterstitialAd('Default');">showInterstitialAd</button></p> <br> <p><button onclick="window.chartboost.preloadMoreAppsAd('Default');">preloadMoreAppsAd</button></p> <p><button onclick="window.chartboost.showMoreAppsAd('Default');">showMoreAppsAd</button></p> <br> <p><button onclick="window.chartboost.preloadRewardedVideoAd('Default');">preloadRewardedVideoAd</button></p> <p><button onclick="window.chartboost.showRewardedVideoAd('Default');">showRewardedVideoAd</button></p> <br> <p><button onclick="alert(window.chartboost.loadedInterstitialAd());">loadedInterstitialAd</button></p> <p><button onclick="alert(window.chartboost.loadedMoreAppsAd());">loadedMoreAppsAd</button></p> <p><button onclick="alert(window.chartboost.loadedRewardedVideoAd());">loadedRewardedVideoAd</button></p> <br> <p><button onclick="alert(window.chartboost.isShowingInterstitialAd());">isShowingInterstitialAd</button></p> <p><button onclick="alert(window.chartboost.isShowingMoreAppsAd());">isShowingdMoreAppsAd</button></p> <p><button onclick="alert(window.chartboost.isShowingRewardedVideoAd());">isShowingRewardedVideoAd</button></p> </body> </html> I don't understand very well how to call this library in a different file. If I would call this library no with the window variable how do you do ? In fact, i make a prototype and I would use this lib inside. Thanks for the learning.
  8. thanks for sharing i don't understand very well what you mean by (sorry i'm not english) : "I'm thinking of a write up of how I achieved some of the things in the game. Let me know if you'd be interested." if you speak about the way you code >>> yes yes i'm interested !!! i 'm fight with to enable charboost videos reward if never you have a solution...
  9. Waouw very polished game. Which person make the assets ? Contact please. Just one thing because all is beautiful, the sound like a trumpet when the game start is not funny. If no +++++
  10. hi, i want to allow these permissions in android : android.permission.INTERNET android.permission.ACCESS_NETWORK_STATE android.permission.WRITE_EXTERNAL_STORAGE android.permission.ACCESS_WIFI_STATE android.permission.READ_PHONE_STATE I think that i couldn't write permissions with an androidmanifest.xml in but the permissions is allow by plugins.... So which plugin(s) do i use in cocoon for allow this ? thanks for your help.
  11. Where I could receive any help about this subject ?
  12. i have this error with adb log : 05-31 13:38:56.239 9005 9005 W System.err: java.lang.Exception: SDK Initialization error. SDK seems to be not initialized properly, check for any integration issues 05-31 13:38:56.240 9005 9005 W System.err: at com.chartboost.sdk.c.t(SourceFile:488) 05-31 13:38:56.240 9005 9005 W System.err: at com.chartboost.sdk.c.r(SourceFile:430) 05-31 13:38:56.240 9005 9005 W System.err: at com.chartboost.sdk.Chartboost.cacheRewardedVideo(SourceFile:758) 05-31 13:38:56.240 9005 9005 W System.err: at 05-31 13:38:56.240 9005 9005 W System.err: at 05-31 13:38:56.240 9005 9005 W System.err: at java.lang.reflect.Method.invoke(Native Method) 05-31 13:38:56.240 9005 9005 W System.err: at$ 05-31 13:38:56.240 9005 9005 W System.err: at android.os.Handler.handleCallback( 05-31 13:38:56.240 9005 9005 W System.err: at android.os.Handler.dispatchMessage( 05-31 13:38:56.240 9005 9005 W System.err: at android.os.Looper.loop( 05-31 13:38:56.240 9005 9005 W System.err: at 05-31 13:38:56.240 9005 9005 W System.err: at java.lang.reflect.Method.invoke(Native Method) 05-31 13:38:56.240 9005 9005 I must say that my appid and appsignature (chartboost) are correct. it's taken from chartboost 's personal page. On the net i have find that's a problem of permissions to the do you specify that with cocoon ? In the config.xml ? doc ? Thanks for yours answers.
  13. hi, since 10 days i'm searching to do show video reward with cocoon and phaser. i have include cordova.js in my index.html and my previous code works with admob and mopub (interstial and banner) but charboost (videos) not . This snippet is the last version, i see the alert dialogs but no videos are playing ! var chartboost_rewardvideo=function(){ alert("charboost") this.chartboostVideo = Cocoon.Ad.Chartboost; this.chartboostVideo.configure({ android: { appId:"50ae12d715ba47c00d01000c", appSignature:"95fb313c08717042903819d76f65d64d2347ac44" } }); this.rewardedVideo=this.chartboostVideo.createRewardedVideo(); this.rewardedVideo.on("reward", function(reward){ // give the player their reward here. }); this.rewardedVideo.load(); alert("load"); alert("show") } please could you help me ? i try also wtih this example but nothing happens >>> no video
  14. hi Nesh108, In fact i don't know how to use this special function "weapon.onFire()" When i type this i receive no message error. I would know when the weapon fire ? maybe with a boolean flag and after i could play an animation with an update function. if i 'm not clear say me.
  15. hi, i search for this feature in the doc with the method onFIre but i that don't work... The onFire Signal is dispatched each time is called, and a Bullet is successfully launched. The callback is set two arguments: a reference to the Weapon that fired the bullet, and a reference to the bullet sprite itself. any suggestion ?