Implementing a calendar

Get help using Construct 2

Post » Tue Sep 10, 2013 7:00 am

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!
B
13
S
5
G
1
Posts: 34
Reputation: 2,022

Post » Tue Sep 10, 2013 7:54 am

Hi Pancholo

Dont see it as you exposing your underwear... see it as an opportunity to learn something

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.



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 I changed your function "MonthNameDays" a bit so it is a bit more simple.

Hope this helps your.

/cvp
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Tue Sep 10, 2013 9:59 am

@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!
B
13
S
5
G
1
Posts: 34
Reputation: 2,022

Post » Tue Sep 10, 2013 11:16 am

Happy to help. Let us know if you get stuck again. and we will see if we can help you.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451


Return to How do I....?

Who is online

Users browsing this forum: oosyrag and 31 guests