text object problem

Just started using Construct 2? Post your questions here

Post » Fri Apr 25, 2014 10:02 pm

509Dave16 wrote:Oh sorry you're right. There is a z-order on every layer sorry about that. I haven't been using Construct 2 for very long so I mix z-order and layers up pretty frequently. Anyways on that layer the Red Box Sprite is always drawn first then you have the a Text objects drawn over the top. However you keep having Text objects drawn on top of each other, so if one has longer text than the other then you'll see it. Like in the case of your 'paragraph 2' message it's longer so when you have the Text object that has the 'paragraph 1' text created it is drawn on top only covering a portion of the 'paragraph 2' message below it.



What do you mean I keep having text objects being drawn? There should only be one, and even when the problem was there, there was only one. I still have no clue what you are talking about.
B
15
S
2
Posts: 105
Reputation: 1,182

Post » Fri Apr 25, 2014 11:05 pm

Referencing your first capx, before you press return there is one text2 object offscreen.
When you press enter the first time another text2 object is created and 1 is added to it's paragraph variable. The first instance will still have a paragraph value of 0 since it wasn't picked when the add 1 action was run. It wasn't picked because when you create a text2 instance it becomes the only instance picked for the actions that follow.

So now there are two instances of text2. One offscreen with a paragraph value of 0 and one on screen with a paragraph value of 1. Now after that when you press return a second time both of your events will run because one instance has a paragraph value of 0 and one has the value of 1.

You could just move the text2 object instead of creating another and set it up like this:
https://dl.dropboxusercontent.com/u/542 ... fixed.capx
or this:
https://dl.dropboxusercontent.com/u/542 ... ixed2.capx

On a side note take a look at the 9patch object. With it you can reproduce the bigredtextbox object exactly using a much smaller image.
B
94
S
33
G
118
Posts: 5,395
Reputation: 75,851

Post » Sat Apr 26, 2014 1:46 am

R0J0hound wrote:Referencing your first capx, before you press return there is one text2 object offscreen.
When you press enter the first time another text2 object is created and 1 is added to it's paragraph variable. The first instance will still have a paragraph value of 0 since it wasn't picked when the add 1 action was run. It wasn't picked because when you create a text2 instance it becomes the only instance picked for the actions that follow.

So now there are two instances of text2. One offscreen with a paragraph value of 0 and one on screen with a paragraph value of 1. Now after that when you press return a second time both of your events will run because one instance has a paragraph value of 0 and one has the value of 1.

You could just move the text2 object instead of creating another and set it up like this:
https://dl.dropboxusercontent.com/u/542 ... fixed.capx
or this:
https://dl.dropboxusercontent.com/u/542 ... ixed2.capx

On a side note take a look at the 9patch object. With it you can reproduce the bigredtextbox object exactly using a much smaller image.



that makes sense, thanks for explaining! :)
B
15
S
2
Posts: 105
Reputation: 1,182

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests