Juanito-cnstrct2's Recent Forum Activity

  • Hello all! long time not posting <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> . Has anybody already tried to create typescript definitions for parts of the construct2 sdk, like the shared properties of the instances (like the ones documented in https://www.scirra.com/manual/25/sdk-reference)?

    I am just asking because I have been working on a new plugin using typescript and before I do my own type definitions I wanted to see if somebody has already done some work in that area.

    I heard rumors that C3 was built using TypeScript but this question is for C2.

    Thank you!

  • I don't have the exact version with me, ( I think I uninstalled it). It was the version back in mid 2012. So about 2 years ago.

  • The Q3D plugin is probably better written than this one. The freeze you are experiencing might be due to a lot of vectors being created. Out of ignorance at tge time, I did not apply some javacsript best practices on memory management.

    Reken : yes, I created the scene using coppecube (the version from 2013 I think). I don't have the latest version of coppercube (expensive) but I would guess the problems you are seeing are due to the copperlich.js library used in the plugin being too old for your scene. If you know javascript, You could try replacing the copperlicht library in the plugin with the library that gets exported in your coppercube scene (i think the file is called copperlicht.js)

  • Did you try the examples from the official tutorial or some other 3rd party example?

  • Fersis , the transparency setting should be in your layer properties (https://www.scirra.com/manual/85/layers). I only had one layer, so I only had to set one layer to "transparent".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • irina : nope, But the plugin should work in its current functionality. You are more than welcome to fork the plugin and develop more stuff with it. One think I think it needs is a rewrite of some of the functions that create too many vector objects on the fly.

  • Wow, Ejecta is getting better and better every day. 0plus1 has done a great job on the unofficial exporter . Too bad I had to cancel my apple dev account ( had a second kid, no time for hobby programming) . Great work everybody! Hopefully this will become an official exporter when I come back to the apple dev program.

  • dunkin Chery : there is now an official websocket plugin, so I don't work on this plugin anymore. However, to answer your question in theoretical terms:

    1. Use the official websocket to send the position of the platform player every so often (15 times a second maybe?)

    2. You can choose the format of sending that data. I would use a letter representing the command (P for position) followed by a comma separated value pair representing X and Y (e.g.: "P",10","302").

    3. Code your node server (you will need non-c2 coding skills for this) to receive the position ("P","10","302") and then sends it to all the other connected clients (other players) with an extra parameter appended that represents the internal ID of the player (e.g.: "P",10","302","1").

    4. On the client side (C2 game) have a OnReceive event when you determine the type of command by spliting the string on commas. So if the first part of the string is P then you know is to update position so pick the sprite with the id of 1 and set its x,y to 10,302.

  • JonathanCastro : I don't know I have not test it wioth those. I no longer work in this plugin. I left it here in case another plugin developer wanted to get the source.

  • I made this app using C2 for the Windows App Store:

    apps.microsoft.com/windows/en-us/app/babysee/c15e9773-bd70-4949-bf39-7d63f6181b6c

    I really like how easy it was to export to Windows 8 compared to iOS.

  • Thanks to vikerman, I was able to get Space Blaster running on webgl in ios using Ejecta (latest build from GitHub). It feels faster than the ejecta canvas version I did before. The TileBackground plugin now works perfectly. I was also able to use the radial blur effect when one of the enemies hit. Hopefully, it is clear in the video when the effect takes place. The youtube video is at

    Subscribe to Construct videos now

    To make it work, I did a diff on Vikerman's work and was able to identify where in the c2runtime.js file you need to make changes for webgl to work on ios with ejecta (no need to do the changes shown in the 1st post of this thread, that is for canvas):

    1. In GLWrap_.prototype.loadTexture remove the last parameter in hte function declaration, so that it reads:

         function (img, tiling, linearsampling, pixelformat) //jpt

    2. In GLWrap_.prototype.loadTexture after gl.texImage2D(gl.TEXTURE_2D, 0, internalformat, format, type, img);

    the following if condition needs to be removed:

    if (tiling)

              {

                  ?if (tiletype === "repeat-x")

                  ?{

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

                  ?}

                  ?else if (tiletype === "repeat-y")

                  ?{

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);

                  ?}

                  ?else

                  ?{

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);

                        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);

                  ?}

              }

              else

              {

                  ?gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);

                  ?gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

              }

              

    and replaced with:

              

              

              gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, tiling ? gl.REPEAT : gl.CLAMP_TO_EDGE); //jpt tiling restructured

              gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, tiling ? gl.REPEAT : gl.CLAMP_TO_EDGE);//jpt tiling restructured, replaces the if(tiling) part

    4. In function Runtime(canvas) add

         this.isEjecta = !!window["ejecta"]; //jpt

              

    after this line

         this.isCocoonJs = !!window["c2cocoonjs"];

    5. Replace

              this.isDomFree = this.isDirectCanvas || this.isCocoonJs;

    with

              this.isDomFree = this.isDirectCanvas || this.isCocoonJs || this.isEjecta; //jpt

    6. also in same function, replace the following:

         if (typeof jQuery !== "undefined" && this.fullscreen_mode > 0)

                  ?this["setSize"](jQuery(window).width(), jQuery(window).height());

                  ?

    with

              if (typeof jQuery !== "undefined" && this.fullscreen_mode > 0 && !this.isEjecta)

                  ?this["setSize"](jQuery(window).width(), jQuery(window).height());

                  ?

    7. In the next "if", replace it with:

         if (this.enableWebGL && (!this.isDomFree || this.isEjecta)) //jpt

    8. Surround the following code with an if for ejecta:

                  ?jQuery(this.overlay_canvas).appendTo(this.canvas.parentNode);

                  ?this.overlay_canvas.oncontextmenu = function (e) { return false; };

                  ?this.overlay_canvas.onselectstart = function (e) { return false; };

                  ?this.overlay_canvas.width = canvas.width;

                  ?this.overlay_canvas.height = canvas.height;

                  ?this.positionOverlayCanvas();

                  ?

    so it should read:

                  ?if (!this.isEjecta)

                  ?{

                  ?jQuery(this.overlay_canvas).appendTo(this.canvas.parentNode);

                  ?this.overlay_canvas.oncontextmenu = function (e) { return false; };

                  ?this.overlay_canvas.onselectstart = function (e) { return false; };

                  ?this.overlay_canvas.width = canvas.width;

                  ?this.overlay_canvas.height = canvas.height;

                  ?this.positionOverlayCanvas();

                  ?}

    9. Add the check in Runtime.prototype.go:

    replace:

         if (this.overlay_canvas)

    with:

         if (!this.isEjecta && this.overlay_canvas) //jpt

              

    10. In Runtime.prototype.go_textures_done:

    add a check around this.canvas.parentNode.removeChild(this.overlay_canvas) :

                  ?if (!this.isEjecta)//jpt

                  ?{

                        this.canvas.parentNode.removeChild(this.overlay_canvas);

                  ?}

    11. also, in the same function, add check to

         if (this.fullscreen_mode >= 2) :

    So it should read:

         if (!this.isEjecta && this.fullscreen_mode >= 2)

         

    The XCode project for the Space Blasters using WebGL with the modified c2runtime.js file is at http://sites.google.com/site/jptarqu/downloads/SpaceBlastersWebGL-ejecta-xcode.zip?attredirects=0&d=1

    By the way, I only wanted to test WebGL in this space blaster version so I left out the GameCenter actions/events I did for my previous experiment. The GameCenter should work even if you use webgl. Also, note that in order to keep good performance on your mobile game, you need to still follow the general guidelines for mobile that have been floating around in this forum, i.e.: not drawing more than 3 times into a pixel, keep physics object count low, use tiled backgrounds instead of sprites when possible, etc.

  • Incompatible plugins:

    • "TMX importer" by Rexrainbow
    • Any other plugin that relies on an XML parser
    • Tiled Backgrounds render as black
Juanito-cnstrct2's avatar

Juanito-cnstrct2

Member since 26 Apr, 2010

Twitter
Juanito-cnstrct2 has 1 followers

Trophy Case

  • 14-Year Club
  • Email Verified

Progress

15/44
How to earn trophies