mekonbekon's Forum Posts

  • Not sure if this is exactly what you're after, but it will generate a map of hex tiles:

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

    You can specify the total number of tiles and tiles per row in the globals.

  • skrotar updated:

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

    I added a little bit of deceleration to get the max speed working, so a slighty hacky solution, but barely noticeable when playing - you can probably increase the ship.decel variable (= less damping) even more and it'll still work.

    If I manage to work out a proper solution (which I think involves limiting the vX, vY separately based on max speed) I'll let you know.

  • You're welcome I'm working on the speed clamp at the mo', I'll update you when its done.

  • skrotar

    How about this?:

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

    Left/Right keys to rotate, Up to accelerate and Space to fire. Word of warning: there's no clamp on the ship's max speed yet, so easy on the gas <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

  • Hi willmonteirofx,

    I've updated the capx again, adding in scrolling for the object layer and locking the hud:

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

    Instead of creating and destroying the picked object I just set it visible and invisible as needed.

    To keep the picked object on the mouse I set its position to mouse.X("picked"), mouse.Y("picked"), which means that it follows the mouse's position relative to the "picked" layer.

    I added now run the check to avoid spawning objects on the inventory against the inventoryFrame object rather than the inventory objects.

    Lastly, I swapped the names of the animations to their respective colour, rather than "one","two" etc, so that the picked text is less confusing.

    Notice that the both the "picked" and "inventory" layers have parallax 0,0.

  • Cheers for the feedback, very useful - I realised that I picked up that book with a bunch of other stuff a while back and forgot to check it out; just had a look at it and all the images are blacked out, not sure why... I'll pop Andreas a line.

    EDIT: Seems to be an issue with Adobe Reader and Edge, opens fine on Opera and Firefox. Chrome refuses to play with any pdfs for some reason :S

  • Out of the options you've listed above is there any one that you would recommend over the others? I've got a bunch of C2 projects that I'm looking to get on the Play store (not too bothered about iOS at the moment) but the range of options is daunting. Also, are there any good up-to-date tutorials covering the process? Most of the ones I've found are a few years old, so I'm uncertain as to their reliability. Thanks in advance for any help you can offer.

  • Do you mean that on the same event e.g. Object A collides with Object B, a random sound will be played?

    If so, one way to do this is to give your sounds a set of indexed filenames like sfx_0, sfx_1, sfx_2.

    Then on your trigger event use the audio action "play (by name)"; in the audio file name field write: "sfx_"&choose(0,1,2)

    You could of course use choose with non-indexed file names e.g. choose("bang","laser","grenade"), but indexing gives you more flexibility, especially if you have a lot of sounds to pick between - you may even want to switch from using choose() to floor(random(min,max)) as this would allow you even more control over what was played.

    For bonus variation add the "Set playback rate" action directly underneath this action, setting the playback rate to a random number.

  • It might cause problems down the line, best to use a value like -1 for values you want to leave blank, just to keep the array tidy. You can then add a condition along the lines of "if value at array(x,y,z) ? -1 do whatever".

    Btw, you don't need to set the size of the array object, it should automatically resize to the dimensions of the json.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • btw, I just entered the numbers 0-23 as sample data, of course you would add your song data here - make sure you change the size settings to properly reflect your array size.

  • You can make it a lot easier to enter all the data by storing it in a json file and then uploading it to an Array object using the AJAX object:

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

    Run this in debug and check the AJAX and Array objects to see how the data loads in.

    The json array file needs the following basic structure for C2 to handle it properly:

    {

    "c2array":true,

    "size":[2,3,4],

    "data":[ [ [0,1,2,3], [4,5,6,7], [8,9,10,11] ],

    [

    [12,13,14,15], [16,17,18,19 ], [20,21,22,23] ]

    ]

    }

    1) Save this text file as *.json and add it to your project by right clicking on the files icon in the Projects bar and selecting "import files".

    2) Add an array object and the AJAX object to your project.

    3) Import your json data into the array object by using the AJAX object:

    On start of layout: AJAX | Request yourArray.json (tag "yourArray")

    AJAX | On "yourArray" completed: Array | Load from JSON string AJAX.LastData

    4) All of your strings should now be in the C2 array.

    You can now work on the array however you want using conditions and actions in C2.

  • willmonteirofx

    Download the capx link again. Items were already being added to the first available slot, but I've also updated it as follows:

    Clicking on an inventory item selects it and adds it to your mouse.

    You can click again in the inventory to return an item to any slot. If there is already an item in that slot then it will swap the item.

    Click outside the inventory to add the object back to the floor.

    The text shows the currently selected item.

    Only one global variable and one instance variable! ;p

  • willmonteirofx

    How about this solution? :

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

    Arrow keys to move the avatar, left click on an inventory item to remove it.

    I just use one item object with the different types set to separate animations, and one inventory object with the same animations plus "none". I then lay out multiple inventory instances.

    At the start I assign each inventory slot with a number (instance variable "no"), based upon its position; I'm using the distance expression to automate this, but you can assign manually if needed.

    Each time the avatar collides with an object the code searches for the inventory instance with the lowest "no" value and an animation of "none" and matches the animation to the object.

  • Like so:

    https://www.dropbox.com/s/b3oprhlsmstee ... t.c3p?dl=0

    You need to ensure the animation speed on the card is set to zero in the sprite editor