Talfuin's Forum Posts

  • 11 posts
  • Haha, okay I see what I've done. So I knew that the months began at 0, but I just added instead of subtracting when I input the month I wanted (October). I've now fixed the brackets and changed the month and it's working great. Thanks so much for your help friend.

    Now I just need to work out a way to generate everyone's next birthday, by using their dates of birth. Just so I don't have to keep changing dates manually.

    If you have any knowledge on that it would be really appreciated, but totally okay if not, you've already helped me loads x

  • You could name the animations 1,2,3,4,5 etc.

    Default = 0

    Tux = 1

    etc.

    Then the code would read something like

    Every tick - set body animation to body

    Would save on having to copy that bit of code for each animation

  • Hey InDWrekt this is really helpful thank you! I'm finding dates in Construct 3/Java to be so confusing. Thanks for helping me understand better.

    So I took your code and added the date of my next birthday into it. (I also added an extra bracket at the end because it was returning a syntax error). This is the code:

    int(Date.ToTotalHours(abs(Date.Difference(Date.Parse(Date.ToDateString(Date.Now)), Date.Get(2021,11,22, 0, 0, 0, 0)))/24))

    However for some reason, this is returning 387 days. Which is more days than are in a year. Unsure what's going wrong here. Any advice would be really appreciated

  • Hey friends,

    I'm making an app to be used on both Android and IOS. I have an array. People's personal information is stored in the array.

    In the 3rd column are people's dates of birth. When I start a layout I want to calculate the number of days till each person's birthday, and load that number into the 4th column of the array. How do I do this?

    I've been trying to work it out, but I'm stuck. I've found two different ways of working out the date; browser based, and the date object. I'm studying this capx which I basically understand, and this capx which I'm really struggling to understand.

    How do I do this? And consequently, what is the best method for determining the date in my scenario?

    Any help deeply appreciated, thanks so much everyone x

    Tagged:

  • You do not have permission to view this post

  • Brilliant! After lots of messing about I have finally gotten it working! I used the second solution in the end for organisations sake, but I understand the first explanation and have learnt valuable things about Construct 3. Thanks so much for taking a look and offering advice, I really appreciate. Hope you're both having a good day xx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the advice calminthenight. Sadly RankArray.at(int(random(0,16))) doesn't seem to work either. Whenever the layout loads, the text box still simply reads "0". Perhaps it's something to do with how I made the array?

    You can find a link to my project files below. You can find what I'm talking a bout in the 'Level Events' event sheet, under the 'Populating Arrays' and 'Start of Layout' event groups.

    dropbox.com/s/e7stqb0zd858tfs/Astronaut%20Fling.c3p

  • Success! The array populates with names! I can see from the debug view that on start of layout the array is being populated with the names in the text file. Thanks so much for that.

    I am now having difficulty with the second part. I am trying to use the code suggested above provided by KacperStasieluk (see printed below)

    text object - set text to: ranksArray.At(round(random(0, 999)))

    I have of course changed the array name and array length to match my situation, but when I run the layout the text object simply reads "0". I don't know what I'm missing. I have tried using slightly different code which I've found in other threads, but the text box always reads "0". I don't understand. Any help is greatly appreciated.

    You can find some images here: imgur.com/a/iDAJVdm

  • That's fabulous, thanks sizcoz that's really helpful I don't fully understand everything in that code but I understand what it's supposed to do. I'll give that a try if have any problems I'll be back. Thanks again x

  • Hey, thanks so much for replying! Yes this sounds like exactly what I need. So the next question is, how do I turn these lists into usable arrays? I know how to create an array manually, by typing everything into cells in the array editor. But how do I do this with large lists? I don't want to have to enter in 1000 names into an array. How do I turn these lists into usable arrays? Apologies if that is a dumb question.

  • Forgot to include the image! See below (hopefully 😬)

  • Hello friends,

    I'm making a little game where you fling astronauts around a solar system. Every time you miss the target with the flung astronaut, I want to show a random rank and name at the top of the screen to show that it's another person being flung next. See image

    I have a text file containing all the ranks that I want to choose from, and I have a text file containing all the names that I want to choose from. Each time an astronaut misses I want to choose from those two lists to create another random rank/name combination

    The rank file is manageably long, but the names file contain thousands of names.

    How do I best achieve this? I have tried to do it using Arrays but I'm genuinely stumped after looking at tutorials.

    Any help would be deeply appreciated

    Thanks <3

  • 11 posts