Implementing a calendar

0 favourites
  • 4 posts
From the Asset Store
c3p file of my tutorial make calendar in construct 3
  • Good evening, fellow Constructors.

    I hesitate and debate a lot whenever I think about making a post, especially if it's a whole new thread, so please, bear with me.

    What I want to achieve is related to looping and spawning certain tiles/blocks in a specific order. I am making a calendar with rexrainbow's system date and time plugin. After some arrays and variables later, I got most of its core set up. Now, all I need to do is have a certain tile spawn many times, filling the calendar (6 rows of 7 tiles each, one per day of the week) depending on the total days of the current month. I have managed to get a loop to spawn just ONE extra tile right beside the original, not the specified 30. Why would that happen?!

    My CAPX. I'm using the beta r141. WARNING: May look messy, I think. I feel like I'm exposing my underwear whenever I show people my code.

    Also, how would I be able to make the days/tiles fill up exactly like calendars do? As in, months starting/ending on the correct days. I can't, for the life of me, figure this one out. I've searched for numerous implementations of Javascript calendars to see how they deal with its code so I could somehow emulate that in pure C2.

    I'm not the type that asks a lot so I try to exhaust my personal research skills first. This is making me go nuts! Thank you, everyone, in advance!

  • Hi Pancholo

    Dont see it as you exposing your underwear... see it as an opportunity to learn something <img src="smileys/smiley2.gif" border="0" align="middle">

    You were actually almost there.

    When you run in to something like this, try to run it with the new AWESOME debug mode.

    When I did that, I could see that you actually did spawn all the days, but they were just spawned on top of each other.

    <img src="https://dl.dropboxusercontent.com/u/2560922/mobiledev/forum/calendarUseDebug.png" border="0">

    I messed a bit around with your iteration over the days. Have a look at it.

    .capx

    And.. while we are at the learning a bit part <img src="smileys/smiley1.gif" border="0" align="middle"> I changed your function "MonthNameDays" a bit so it is a bit more simple.

    Hope this helps your.

    /cvp

  • cvp

    How wonderful! I'm finally grasping the looping concepts in C2 better now that I'm implementing them in things of actual use to me. Thank you! Also, the change you made to the first function is simply genius. I need to further develop my programming creativity to see little stuff like that.

    Anyway, I am now in the process of seeing how to better implement the days of the week for when months start having irregular starting days (like a month starting on Wednesday instead of Sunday, for example). Apparently, it seems that I need to manually tell the calendar which is the first day of a certain month, and it picks up from that - at least that's how I've seen most Javascript calendars being made.

    Once again, thank you for such a quick reply!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Happy to help. Let us know if you get stuck again. and we will see if we can help you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)