mekonbekon's Forum Posts

  • khelaghor No worries, glad to be able to help

  • I want to limit the input of the user from (1-4). Could you please tell me how can I do that?

    You could use the Textbox:set text action before assigning to a variable e.g.:

    If int(textbox.Text)>4 set Textbox text to 4; set variable to int(textbox.Text)

    If int(textbox.Text)<0 set Textbox text to 0; set variable to int(textbox.Text)

    Problem is I have 10 textboxes same object. Shall I make 10 different textboxes or can I do with same textbox?

    If you are assigning the values to an array, add an instance variable to the textbox object, give each textbox a unique value from 0-9 and then use that to assign the value to the array e.g.:

    Set array value at (textbox.instanceNo, 0) to int(textbox.Text)

  • You can use NOT overlapping at offset to achieve this:

    https://www.dropbox.com/s/5qqsnpty5stey ... .capx?dl=0

  • Hi sizcoz,

    This looks really good and just what I was after! Thanks!

    One question, will this work in a Cordova export for mobile, or is it only suitable for HTML5 exports?

  • You can use the following expressions to convert strings to numbers (from the manual):

    float(x)

    Convert the integer or text x to a float (fractional number). If x is text, non-numeric characters are allowed after the number, but not before. For example float("3.1xx") returns 3.1, but float("xx3.1") returns 0.

    int(x)

    Convert the float or text x to an integer (whole number). If x is text, non-numeric characters are allowed after the number, but not before. For example int("33xx") returns 33, but int("xx33") returns 0.

    So if you want to assign the contents of a textbox object to a variable as a number, use the following action:

    Set variable to float(Textbox.Text)

    ...or...

    Set variable to int(Textbox.Text)

    ...depending upon how you want to store the number.

    You can then assign that variable to an array index.

    Alternatively you can skip the variable assignment and go straight to the array:

    Set Array.at(X,Y) to float(Textbox.Text)

  • bump

  • if the button is definitely registering the click then try adding a loader layout and make sure all sounds are preloaded, rather than starting on the Home screen.

  • pcprice76 No worries, glad to be able to help out

  • It's hard to tell without seeing the capx. Maybe the page is still loading in the background? Perhaps switch to a different frame on the button when it's been clicked, at least that way you can tell whether it's because the button isn't registering or because there's a delay before loading the next layout after the click has been registered.

  • Here are three different ways you can spawn random objects:

    https://www.dropbox.com/s/ukysthmxiv9cf ... .capx?dl=0

    Method 1) Add objects to a family and then spawn the family object - a family member will be picked at random.

    Method 2) Save different animations on a sprite and then choose a random animation after spawning.

    Method 3) Save different frames to an animation on a sprite and then choose a random frame after spawning (remember to set the animation speed to 0 in the sprite settings).

  • Hi armaldio, is this plugin is still operational, and if so does it play nicely with PhoneGap or Cocoon.io exports?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi all,

    I'm currently developing a tool that uses speech synthesis - the HTML5 export runs fine in most browsers, but are there any known limitations/issues if I was to do a Cordova export and wrap with PhoneGap or Cocoon.io for Android and iOS?

    Thanks in advance for any help you can offer.

  • I just cooked up this test:

    https://www.dropbox.com/s/lhrwuek3mudx0 ... .capx?dl=0

    It tests 3 different cases:

    1) 1 sprite, 10 frames on 1 animation

    2) 1 sprite, 10 animations with 1 frame

    3) 1 family, 10 sprites, 1 frame on 1 animation

    The sprites (or the family in case 3) have bullet and sine behaviours.

    The test spawns an instance every tick until the framerate dips below 50 fps. I compared the total number of sprites spawned before the test maxed out.

    Results: Cases 1 and 2 ran about the same, but case 3, using the family, spawned about 10% more instances, so it seems that in this test having multiple sprite objects with less animations/frames is more efficient than less sprite objects housing multiple animations.

    Bear in mind that I was hitting over 2600 sprites before it stopped in all three cases on my laptop, so for most purposes you're probably better off going the route that allows you to most efficiently organise your code and assets.

  • In some (but not all) situations there are gains to be made in performance by limiting the total number of different sprites objects in your game, but there are also other good reasons for containing multiple objects on a single sprite, mainly by making your project a little more readable and simplifying the code requirements.

    There are a few factors to consider before determining what the best solution would be:

    1) I would tend to only include objects on the same sprite that appear on the same layout as you would otherwise be filling up your memory for each layout with unnecessary art assets.

    2) I would only include objects on the same sprite that have simple behaviours and use the same basic logic e.g. all inventory items, otherwise your code will become overly complex trying to differentiate between the objects when you could instead just refer directly to a specific sprite.

    3) If there were groups of objects that appeared on different layouts with similar behaviours, or objects with quite complex behaviours and multiple animations on the same layout, then I would prefer to put them on separate sprites and add them to a family so that I can still use the same code groups to control them.

    4) In certain circumstances I would use the individual frames on a single animation for different objects e.g. scenery objects, non-animated pick-ups. This also makes it quicker to import graphics as you can import a sprite strip to a single animation instead of individual frames to separate animations.

    5) It is much easier to perform actions like spawning random objects when they are on a single sprite: for example, if I had 10 pickups and wanted to spawn a random one then if the pickups were on separate sprite objects I would need to assign a random number to a variable to determine the pickup and then have a string of 10 conditions to spawn the correct one; if instead I had each pickup on a single frame or animation then I just spawn the sprite and pick a random frame or animation - 2 actions on 1 event as opposed to 10 conditions.

  • shushpo

    You're welcome