I just spent over an hour debugging a problem in my Construct 2 code. Suffice to say the solution is now ingrained in my brain. Now, I want to explain a little intricacy of C2.
TLDR: In Construct 2, whenever you are dealing with text and you want to concatenate/append additional text (or a variable), then you need to use the ampersand "&" symbol. Using the plus "+" symbol will cause a silent error/bug, i.e. the program won't tell you that there is a bug. Ex: If I try to set text to "Score: " + PlayerScore, then the value of the variable `PlayerScore` will not appear. The correct way to set the text would have been: "Score: " & PlayerScore. Note, the only difference between the two codes was the plus and ampersand.
Other programming languages have "overloaded" concatenaters, meaning the "+" symbol in some languages like Java are contextual. Depending on the value to the right and left of the plus sign, it will act a different way rather than not working at all, as in C2.
In Construct 2, the only time that you should use the plus symbol is when you want to add two numbers together. That is it.
Anyways, the issue that I was trying to solve for over an hour involved using WebStorage and Functions with programmatically assigned parameters. Saving and retrieving values was working great, just not exactly the way I wanted it to. I had a highscores table for easy, medium, and hard difficulties, but they were all staying the same values across each of them. My buggy code included lots of ampersands surrounding the entire area, but basically, this is what it looked like: Save("HighScore" + LevelDifficulty, PlayerPoints). Note: The plus sign is wrong.
No programming languages I use have the ampersand as a String concatenate. So, when I viewed the code snippets a few times, even completely writing them, my mind knew exactly that String + String should be working.
If I hadn't already read the manual/documentation before this point, then I probably wouldn't have found the answer myself.
Experience built through learned mistakes.
~ Danial Goodwin ~
ps - Just in case I haven't said it enough yet... When you are using Construct 2 and dealing with text, use the ampersand, &. Don't use the plus, +, sign!
Showing posts with label fix. Show all posts
Showing posts with label fix. Show all posts
2014-02-21
2014-01-11
Construct 2: Reporting Bugs for Windows Phone 8
For the past few WP8 apps I've been creating using Construct 2, I've been manually making the necessary bug fixes myself. Today I've decided to properly report three of these bugs to the developers of Construct 2. My last bug report that I sent to them a few weeks ago was fixed. And, I expect the same with these bugs, especially, since I described them almost like I fixed it for them. ;)
The three errors reported:
- WP8 Export: Fullscreen not being set
- WP8 Export: App title not carrying over to WP8
- Windows Phone 8 Export, no apostrophes allowed
In the meantime, until these errors are fixed, you can visit the links to see how I solved the problems manually. If the links don't work, then that most likely means that the bug has been fixed and the bug report post has moved to a different place.
UPDATE: Each of these reported bugs have now been fixed! Construct 2, release 157
~ Danial Goodwin ~
The three errors reported:
- WP8 Export: Fullscreen not being set
- WP8 Export: App title not carrying over to WP8
- Windows Phone 8 Export, no apostrophes allowed
In the meantime, until these errors are fixed, you can visit the links to see how I solved the problems manually. If the links don't work, then that most likely means that the bug has been fixed and the bug report post has moved to a different place.
UPDATE: Each of these reported bugs have now been fixed! Construct 2, release 157
~ Danial Goodwin ~
2013-12-19
Construct 2: Landscape Bug Fixed for Windows Phone 8 Export
A few days ago, I submitted a thorough bug report for Windows Phone 8 apps made from Construct 2 not going to landscape mode when it's supposed to. But, thanks to the great developers of C2, this bug has now been quickly fixed for the current beta release r155. So, this saves you C2 developers an extra step.
Get Construct 2
~ Danial Goodwin ~
Get Construct 2
~ Danial Goodwin ~
2013-12-15
C2: [Bug Fix] Windows Phone Export Doesn't Go Full-Screen or Landscape Mode
So, in my quest to create 100 Windows apps, I'm finding more solutions to bugs/issues/problems with the export of Windows Phone from Construct 2.
Problem: No Fullscreen. Here's how to fix it:
1. After you have exported the app from Construct 2, open MainPage.xaml
2. Find the line that says:
shell:SystemTray.IsVisible="True"
And, change it to:
shell:SystemTray.IsVisible="False"
Problem: No Landscape Mode. Here's how to fix it:
1. After you have exported the app from Construct 2, open MainPage.xaml
2. Find the line that says:
SupportedOrientations="Portrait" Orientation="Portrait"
And, change it to:
SupportedOrientations="Landscape" Orientation="Landscape"
That should do it! =]
UPDATE: The landscape mode problem has now been fixed! (2013-12-19)
~ Danial Goodwin ~
Problem: No Fullscreen. Here's how to fix it:
1. After you have exported the app from Construct 2, open MainPage.xaml
2. Find the line that says:
shell:SystemTray.IsVisible="True"
And, change it to:
shell:SystemTray.IsVisible="False"
Problem: No Landscape Mode. Here's how to fix it:
1. After you have exported the app from Construct 2, open MainPage.xaml
2. Find the line that says:
SupportedOrientations="Portrait" Orientation="Portrait"
And, change it to:
SupportedOrientations="Landscape" Orientation="Landscape"
That should do it! =]
UPDATE: The landscape mode problem has now been fixed! (2013-12-19)
~ Danial Goodwin ~
2013-12-13
Bug Fix: Windows Phone Not Detected, Can't Connect To Windows Phone Developer Registration
The Problem:
"Status: Unable to connect to a phone. For Windows Phone 7 phones make sure the Zune software is running and the Zune recognizes your phone. For Windows Phone 8 phones make sure that the Windows Phone IP Over USB Transport (IpOverUsbSvc) service is running."
The Solution:
- What worked for me was just using a regular USB cable and plugging it in directly to the computer rather than going through an USB hub.
- For many other, what works is ensuring that "Windows Phone IP Over USB Transport" (IpOverUsbSvc) is running. How to do that? Here's an easiest way: Go into start, search "Administrative Tools" -> Click "Services", then find and double-click on "Windows Phone IP Over USB Transport", and find the start or maybe even the reset button.
~ Danial Goodwin ~
"Status: Unable to connect to a phone. For Windows Phone 7 phones make sure the Zune software is running and the Zune recognizes your phone. For Windows Phone 8 phones make sure that the Windows Phone IP Over USB Transport (IpOverUsbSvc) service is running."
The Solution:
- What worked for me was just using a regular USB cable and plugging it in directly to the computer rather than going through an USB hub.
- For many other, what works is ensuring that "Windows Phone IP Over USB Transport" (IpOverUsbSvc) is running. How to do that? Here's an easiest way: Go into start, search "Administrative Tools" -> Click "Services", then find and double-click on "Windows Phone IP Over USB Transport", and find the start or maybe even the reset button.
~ Danial Goodwin ~
C2: Bug Fix for Windows Phone Orientation
Currently, in Construct 2 r152, there is a bug that always puts the Windows Phone 8 export in portrait mode. This can be changed after exporting and viewing in Visual Studios. Open MainPage.xaml, find the line that says orientation or portrait and change that value to landscape, or whatever you would like.
~ Danial Goodwin ~
~ Danial Goodwin ~
Subscribe to:
Posts (Atom)