Pode's Recent Forum Activity

  • Lprez: you can use the solution I present I the main C2 section of the forum.

  • R0J0hound: I just noticed that if you want pixels added in realtime to the canvas when drawing with the mouse, you need to "force refresh" on the canvas. To do that, I use two actions consequently (i.e SetInvisible by SetVisible). Apart from that, everything is great !

  • I needed html5 audio on ios 5 (ipad exactly) for a client. Since the audio support on MobileSafari and UIWebView is somewhat sketchy, it was impossible to certify a sound playing on touch without lag (or sometime no sound at all).

    Here's the limitation for the audio tag on iOS5 (and previous) : you can't initiate (preload or play) a sound without a user interaction first. Even after that, you can't be sure when the audio file is going to be loaded or streamed, and you don't know when it's going to stop. Furthermore, no possibility to play several sounds mixed together.

    I then remembered of the concept of "audio sprites". You load a sprite consisting of all your SFX pasted in a unique file, and then you move the head along the file when you need to play a specific sound.

    I found two implementations for Javascript (https://github.com/koggdal/AudioSprite & remysharp.com/2010/12/23/audio-sprites/), and chose the first one.

    Here's the demo http://dl.dropbox.com/u/1412774/AudioSpriteExample/index.html (you're not going to hear any sound if you are not using an ipad or an iphone to access it...). I tested it against iOS 4.X & iOS 5.

    Since I don't have access to the core C2 script (and injecting something inside the prettyfied minified JS is not something I can handle without breaking things), I added the JS file inside the HTML page exported by Construct.

    So you need to :

    1) put http://dl.dropbox.com/u/1412774/AudioSpriteExample/audiosprite2.js inside your exported game folder, next to your index.html

    2) concatenate all you audio SFX inside a single audio file. Put blank audio part between your sounds, and make a quick note of the starting and ending timing for each one of them (in milliseconds. You can use something like Audacity).

    3) put a file like http://dl.dropbox.com/u/1412774/AudioSpriteExample/audiomodif.js at the root, and modify it to reflect you audio structure.

    In the create function, you need to add the number of samples, and their timing.

    function create(){

         sprite = new AudioSprite("audiosprite.mp3", [ { start: 50, length: 450 }, { start: 800, length: 900 }, { start: 1601, length: 2200 } ])

         sound1 = new Sound(sprite, 0);

         sound2 = new Sound(sprite, 1);

         sound3 = new Sound(sprite, 2);

    }

    Don't forget to add a var and a function to play each of those sounds !

    var sound4;

    function play4(){

         sound4.play();

    }

    4) By using the wonderful CallJS plugin (http://www.scirra.com/forum/plugin-call-javascript_topic45866.html), you can bind the create() and play() functions of your external JS to actions inside your C2 game.

    4.1) Since it's a limitation of iOS, you need to start the sound loading by initiating a user action. I "force" him to click on something on screen, and bind that action the the create() function with CallJS (you can see the example here http://dl.dropbox.com/u/1412774/AudioSpriteExample/AudioSpriteExample.capx).

    4.2) I attach the various "playX()" calls to the various objects inside my C2 scene.

    And.... DONE !

    Some caveats, though : you can only play one sound at a time with JS on iOS (it steams from the fact that javascript can only send one sound buffer at a time to the decoder, and can't premix those buffers). So you're not going to be able to play a background music and sound SFX on top of that.

    Before yelling that is doesn't work, check the file format you are using oin the platform for your concatenated sound (.mp3/.m4a and not .ogg for iOS), and double check that the embedded url inside your JS file reflect that.

  • Dirty trick : put a sprite on top of the text you wan to change, with the background color of the sprite set as the color you want for your text. Then set effect=>Additive on the sprite. It should do the trick...

  • Joshua: don't hesitate to post some files here to ask for help on some pieces of the game (not the whole game so you're not afraid of somebody stealing your work). Lot of people here can give you a hand on some things, because we potentially use them in our own production (so you're not forced to recreate the wheel => quicker dev cycle => maybe quicker bucks on you bank account).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Something like that ? http://dl.dropbox.com/u/1412774/walk.capx

  • I embarqued this morning on a project for a plugin to manipulate & change the URLs, and I remembered your nice plugin. It's way more quicker to use it to do things like that !

    So, here's an example, which shows how to change the url you are currently browsing when clicking on a button inside C2's canvas. Beware, everything you were doing on your game can be lost !

    I added a second button. When you click on the first one to go to google (for example), and go back with the 'back' button of your browser, you can use the second button to navigate forward in the history tree.

    http://dl.dropbox.com/u/1412774/URLs_and_Timeouts.capx

  • If I understand well what you have done, you dissociate the angle of the car from the trajectory, by using "targets" above each waypoints.

    The linear interpolation part is there to give a nicer movement profile for the car.

  • I don't know why, but the answer I gave to Yann was not displayed in the right thread...

    So, I just said "@Yann : sorry for the explanation. Anyway, the feeling you gave to the car is great ! ".

    I'm removing it from the other thread...

  • Edit : wrong post...

  • Here's a little example I made http://dl.dropbox.com/u/1412774/cargame.capx.

    <img src="http://dl.dropbox.com/u/1412774/screenshot.png" border="0">

    It's a micromachine like game, where I want the car controlled by the computer to have a plausible behavior. I used a series of waypoint, but I can't get the physics to create a lifelike movement (I even have problem with the angle at the start of the game...)

    I use to "dummy" object to store the values of the previous and next waypoint.

    (and by the way, I don't own any rights for the image used as background, so don't use it for any commercial stuff, I can't give them to you !)

  • SullyTheStrange : Wow ! Nice trick :).

    It's very helpful. I'm always asking myself the question, when I stumble on a dev block inside Construct 2 : "If it doesn't work, is it because I'm not wrapping my head around C2 way of doing things, or am I right in my trying ?"...

Pode's avatar

Pode

Member since 3 Sep, 2011

Twitter
Pode has 11 followers

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies