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 text. Show all posts
Showing posts with label text. Show all posts
2014-02-21
2014-02-01
Level Up - WP Dev: How to Remove Debug Information From Windows Phone Emulator
(This post is for developers of the Windows Phone platform.)
Ever find the frame rate counters and other debug information on the Windows Phone emulator more annoying than useful? It always appears there, whether in debug mode or release mode.
What if you want to get a clean screenshot without having to edit the image later? The red and white performance information on the side of the emulator screen is a nice feature, but I haven't needed to use it much in my recent apps.
It's possible. And, you only have to change one word.
How To:
1. Open App.xaml.cs.
2. Find the line that says `Application.Current.Host.Settings.EnableFrameRateCounter = true;`.
3. Change `true` to `false`.
That's it!
Now, you can get the full/real experience that end users would get when using your app, emulator style.
Feel free to share this with other WP devs that you know.
Source: http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg588380(v=vs.105).aspx
~ Danial Goodwin ~
Ever find the frame rate counters and other debug information on the Windows Phone emulator more annoying than useful? It always appears there, whether in debug mode or release mode.
What if you want to get a clean screenshot without having to edit the image later? The red and white performance information on the side of the emulator screen is a nice feature, but I haven't needed to use it much in my recent apps.
It's possible. And, you only have to change one word.
How To:
1. Open App.xaml.cs.
2. Find the line that says `Application.Current.Host.Settings.EnableFrameRateCounter = true;`.
3. Change `true` to `false`.
That's it!
Now, you can get the full/real experience that end users would get when using your app, emulator style.
Feel free to share this with other WP devs that you know.
![]() |
| By default, the emulator has debug information on it. |
Source: http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg588380(v=vs.105).aspx
~ Danial Goodwin ~
2013-01-23
App to Clipboard Multiple Items
I may have mentioned this before, but just now I thought of a good way to do this on a desktop computer. If there is anybody else who would like to save multiple items to their clipboard, then please email me or contact me via Google Plus.
I believe this can help me while programming, and I'm sure there are other uses for it too.
The first version would just have the ability to copy different text to multiple clipboards, then future versions would have the ability to save anything.
~ Simply Advanced ~
I believe this can help me while programming, and I'm sure there are other uses for it too.
The first version would just have the ability to copy different text to multiple clipboards, then future versions would have the ability to save anything.
~ Simply Advanced ~
2012-12-10
Highlight Text in PowerPoint
There is no easy way to highlight text in PowerPoint. There is an easy method for Microsoft Word. But, PowerPoint wants you to first draw a rectangle around the text and use the "Shape Fill" feature...
Please, somebody prove me wrong. Show me an easier way to highlight text in PowerPoint 2010.
~ Simply Advanced ~
Please, somebody prove me wrong. Show me an easier way to highlight text in PowerPoint 2010.
~ Simply Advanced ~
2012-11-08
Sticky Notes Shortcuts You Didn't Know
The desktop application I am talking about today is Sticky Notes that comes standard in Windows.
I used to think that Sticky Notes was a featureless program. But, one day I decided to try out some formatting shortcut keys that I typically use in other Windows products. So, then I discovered that the application supports Ctrl+b for bold, Ctrl+e for aligning text to center, Ctrl+Shift+> for increasing text size, and more. This has made Sticky Notes much more useful than before.
I used to think that just writing on paper was the quickest way to keep notes and a todo list. But now, for efficiency, I use just one large Sticky Note on my desktop. This has the added benefit of not having to throw away physical paper.
List of hidden Sticky Notes shortcuts:
I'd like the chance to answer any questions.
~ Simply Advanced ~
I used to think that Sticky Notes was a featureless program. But, one day I decided to try out some formatting shortcut keys that I typically use in other Windows products. So, then I discovered that the application supports Ctrl+b for bold, Ctrl+e for aligning text to center, Ctrl+Shift+> for increasing text size, and more. This has made Sticky Notes much more useful than before.
I used to think that just writing on paper was the quickest way to keep notes and a todo list. But now, for efficiency, I use just one large Sticky Note on my desktop. This has the added benefit of not having to throw away physical paper.
List of hidden Sticky Notes shortcuts:
| Bold | Ctrl+b |
| Italic | Ctrl+i |
| Underline | Ctrl+u |
| Strikethrough | Ctrl+t |
| Decrease Font Size | Ctrl+Shift+< |
| Increase Font Size | Ctrl+Shift+> |
| Align Text Left | Ctrl+l |
| Align Text Right | Ctrl+r |
| Bullet/Numbered Lists | Ctrl+Shift+L |
| Subscript | Ctrl+= |
| Superscript | Ctrl+Shift+= |
I'd like the chance to answer any questions.
~ Simply Advanced ~
Subscribe to:
Posts (Atom)
