0 Favourites

Layers, functions and Z-order

This forum is currently in read-only mode.
  • Hi, i have a problem with my game. I'll try to explain as my best, i'm french. <img src="smileys/smiley1.gif" border="0" align="middle" />

    I have in my game a main layout "stage", where i include an event sheet "character". In this event sheet, i include an another one called "spells".

    In the layout "stage" i have 4 layers : "couche 1", "couche 2", "couche 3" and "HUD". With this, i'll be able to manage Z order easier.

    Now, in the event sheet "spells" :

    I use functions to cast spells. I have for now 2 functions.

    1�- The first one after some effects, put a variable to 1, and outside the function, when this variable is egal to 1, an object is created at layer "couche 2"

    2�- The second one, create an other object in the function at layer "couche2".

    The 1�- works, but the 2�- doesn't work. The debug says "layer "couche 2" doesn't exist".

    What can I do to correct this please ? Tell me if you want more details.

    Thanks a lot !

  • Can you upload your CAP file so we can test it?

  • Hi and thanks.

    Here is the link : -Deleted-

    Here, the global variable "classe" is "mage". Try with this, and press the button 1 (with your keyboard) then click.

    Try also by changing the global variable "classe" to "combattant". Try with this and press button 1 (with mouse on the game).

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Nothing happens when I press 1 on the keyboard. It seems that pressing 1 should cause spell 1 to be cast, but for that to happen, the private variable 'cible' has to be either "oui" or "non." I ran your game in debug mode, and I saw that 'cible' was blank. Was there supposed to be an event that would set 'cible' to "oui" or "non"?

    Looks like you've already done a lot of work on your game. It's getting hard to debug, so I suggest that you debug everything first before you add more events.

    I do have a couple of suggestions at this point.

    First, you should make your background image a Tiled Background instead of a Sprite. Tiled Backgrounds use up less memory and do not require the features of a Sprite.

    Second, if you need a variable like 'cible' that stores only "oui" or "non," consider making it numeric and store the numbers 1 for "oui" and 0 for "non." Your game will use up less computing resources that way.

  • Hi, and thanks for the answer.

    Did you press 1 in your NumPad ? Because this is not that. This is the 1 at the top of the keybaord (near F1, F2, etc...). And when I press 1, this is working.

    Look at the "sorts" event sheet at the beginning, Start of Layout > i read an INI file and store values in private variables.

    I replaced the "oui"/"non" by 1 and 0.

    But, for the Tiled Background, i put a sprite, solid, then i erased path at the collision mask of this sprite, so the character can walk in. But with a Tiled Background, it works also. However, I can't put an event like "On collision with TiledBackground".

    Thanks a lot for your help.

  • Hi, after long and long research, i found a solution : The "Layout" object is a problem ! It causes problem everywhere. So i used Inherited Layer and it's fine !

    Thanks for your help ! If you have others ideas about optimization, please tell me ! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
27 6,146
Jase00's avatar
Jase00
Unread hot topic
0 Favourites
feature request: layer offset
45 2,493
lennaert's avatar
lennaert
Unread hot topic
43 4,537
newt's avatar
newt