Strange Behavior

Get help using Construct 2

Post » Fri Aug 02, 2013 8:26 am

Situation 1: When I try to make the user input appear only if it isn't already there.



Situation 1 Output:



It seems like half of the gray background box is cut off, and the text that is supposed to spawn doesn't appear at all.

Situation 2: The 'old code' that works, but if multiple spawn points are selected then the user input box will appear multiple times and overlap with itself.



Situation 2 Output:



Basically I'm trying to prevent the gray user input box from spawning multiple times and overlapping with itself if the user selects a different spawn point. My logic is that I should just be able to check if the box count = 0 before spawning the user input box, but that seems to prevent half the box from displaying in the first place (and the instructions text isn't there either).

BoardGame.capx
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 02, 2013 8:39 am

You wont get rid of me by making a new thread

Looking at your capx atm but havent really found your issue yet. But... is there any reason why you create and destroy the menu each time? cant you just make the menu visible/invisible each time?

There is also an issue with your tooltip not going away if you go from 1 spawntype to another. (because your destroy funtion only destroys the tooltip if you are not hovering over one of the spawnpoints) So if you get the tooltip for Hack and then move the mouse directly to Bitware then the tooltip for Hack will stay.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Fri Aug 02, 2013 8:42 am

@cvp hahaha, to be honest I generally post problems here as I'm working on solving them and if I find a solution before someone else does, I usually delete the thread.

I think performance-wise, you are correct that I should be making the menu visible/invisible instead of constantly creating and destroying it. I'll go ahead and make that change now, and then work on addressing the second issue you mentioned.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 02, 2013 8:51 am

@cvp I've updated the .capx so the program spawn window is on its own separate layer that is invisible when a spawn point isn't selected and visible when one has been selected.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 02, 2013 8:52 am

@Excal

The reason why you are only seeing a menu background is because you spawn it half way out of your layout.
Your image origin on the menu background (ProgramSpawnBG) is in the middle. I tried setting the Y value of the ProgramSpawnBG orgin to 0. That made the whole menu show.cvp2013-08-02 08:52:48
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Fri Aug 02, 2013 9:00 am

I'm a little confused. Are you talking about the origin of the ProgramSpawnBG sprite, which would be in the middle of the sprite?

Or are you referring to where the ProgramSpawnBG sprite is spawned?


EDIT: Nevermind, I see what you mean now.Excal2013-08-02 09:07:04
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Fri Aug 02, 2013 9:26 am

@Excal

Dont know if you noticed.. but i am a bit bored today

You already have a family for your menu objects. So why not use them to reduce the amount of code you have?

I have made a few alterations. Have a look at this .capx it should do the same as your code. But with less code.

I moved your menu variables up to the family level as they were all the same. Then instead of calling a function for each i put those together as well.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Fri Aug 02, 2013 9:39 am

@cvp thanks for cleaning up my code :)

I noticed you removed all the separate program spawn functions and added a single spawn function. It's definitely a lot cleaner.

I sent you a PM. I've having some issues creating an inventory system and might need some help ;)Excal2013-08-02 09:39:30
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, drexegar, Phacanu and 8 guests