AllanR's Recent Forum Activity

  • ErudioLtd Magistross

    for future reference - you can set the z-order of the form elements to change the tab order.

  • mchulet

    like NoSoul8 said, the hour hand moves 30 degrees per hour (360/12). The minute hand moves 6 degrees per minute (360/60).

    Since there are 60 minutes in an hour, that means that the hour hand moves 30/60 or 0.5 degrees every minute. So, you take the number of minutes and multiply it by how much the hour hand moves per minute:

    if the minute hand at the 6 on the clock face (30 minutes after hour), the hour hand should be half way between two hours (30 minutes x 0.5 = 15 degrees).

    if the minute hand is at the 9, then the hour hand should be at 45 minutes x 0.5 or 22.5 degrees past the hour it started at.

    if the minute hand is at the 2, then the hour hand should be at 10 minutes x 0.5 or 5 degrees past the hour it started at...

    so, if the time is 4:15 then the hour hand will be at 4 x 30 + 15 x 0.5 = 127.5 degrees, which will place it a quarter of the way past the 4.

    (obviously, you still have to add in the 270 degrees to get the hands positioned relative to 12 o'clock, because C2 thinks zero degrees is at 3 o'clock)

  • mumu64

    I have used on touch on many iphones with no trouble. On Click refers to mouse input and will not respond to a touch, On Touch will respond to a touch and a mouse click (unless you tell the Touch object to not also act as a mouse).

    so make sure you aren't mixing up your events...

  • sebastiangohhy

    You have to zero pad numbers if you want them to sort properly - the array sort does a text based sort.

    so, when you put a number into the array use zeropad(number,digits)

    when you need to use then number later, convert it back to a number using int(arrayvalue) or float(arrayvalue)...

  • Dain

    in your player 2 group, you changed Gamepad 0 to Gamepad 1 in the top Gamepad field, but in the value field you still reference Gamepad 0.

    Gamepad.Axis(0,0)/4 should be Gamepad.Axis(1,0)/4

    in all cases the first number in the .Axis expression should be 1 for Gamepad 1

    don't forget the two occurrences where you set bullet angle of motion in event 29.

  • bbjGames

    I think you will always get the lowest total by multiplying the biggest number by the smallest, then the next biggest number by the next smallest...

    you shouldn't have to try every combination. Just sort them and match them up - first with last, second with second last...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • tetuan

    I would create a function to pick the next word, and remove the random action in event 3. (You don't really want to keeping picking a word every cycle of the loop). When the loop finishes loading the array, then call the function. The function can pick a random word and delete that line out of the array so the word does not get picked again. And the function can reset anything else that needs resetting.

  • MPPlantOfficial

    you can also use TouchID to keep track of which touch should apply to which object.

  • newt

    Are you sure you are running the layouts in the order you think you are? (I always forget to select the layout I want when testing).

    it works the way I would expect. There are two loops - an inner and outer loop. The inner loop "y" runs 9 times for each of the outer loop "x" cycles.

    when you create the sprite object, you will get either rows or columns depending on which order you put the loopindex variables in the create object.

    The first layout gives me rows the way I would expect, because the first coordinate given is the Y loopindex.

    The second layout makes columns because the inner loop is now in second coordinate...

  • jhjconstruct

    I do a lot of database work with C2. I typically use 3 arrays: one to hold the data, a second one to filter the data, and the third to sort the filtered data.

    The filter array only needs one column, which is the row number of the main array for any rows matching the filter criteria. The index array has two columns - the first is for the data being sorted, and the second is the line number to the filter array (which is just a link to the main array). basically you copy the column you want to sort from the main data array into column 0 of the index array, (and the row number it came from in column 1). Then use C2's array sort. This works great for databases with up to thousands of records. After that, you would want to send queries to your database, and let its engine do the work...

    I made a quick sample, just using a main array and an index array. first it loads some data, then sorts the main array (in descending order). Then it builds the index with a primary and secondary sort field.

    You will see that I often use constant variables for the field names - this makes reading the code much easier a few weeks / months later when you are trying to figure out what is going on...

    you can get my sample here: http://www.rieperts.com/games/forum/SortArray.capx

    for your original question, if you just have columns: score, name, address in your array

    and only want to sort by score, then you do not need to make an index, just sort the array. The name and address will stay with the corresponding score.

  • tunepunk

    Rather than add them to an array, can you just set an instance variable? Kind of like what ROJOhound suggested, but without the intermediate step of collecting the UIDs, then setting the instance variable to pick them later... just set the Picked variable in the loop that would save the UID or add it to the array.

    How often does this need to happen? Is it actually affecting performance? processors can loop through a lot of data before it becomes a problem!

  • mchulet

    I just grabbed a random clock face from a google search and then made the hands smaller so they fit on it.

    Yes, you can calculate any angle you need from a given time, or check the time from an angle. So, if the time is 8:50, then the angle for the hour hand will be 8 x 30 + 270, and the angle for the minute hand will be 50 x 6 + 270.

    the general formula from a given time is:

    number of minutes x (360 / 60) + 270

    number of hours x (360 / 12) + 270

    or if the hands have been set, and you want to know what time they were set to:

    hour: round(((clockarmhour.Angle+90) / 30)%12)

    minute: round(((clockarmminute.Angle+90) / 6)%60)

    seconds: round(((Sprite.Angle+90) / 6)%60)

    (We have to add 90 degrees to get the angle back to what C2 understands - since we added 270 earlier. If we subtract the 270 out, then we get negative numbers that are slightly harder to deal with. At the end we have %12 or MODULO 12 to keep the hours between 0 and 12. The minutes and seconds have %60 to keep those numbers between 0 and 60)

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies