levering_k's Recent Forum Activity

  • Hello,

    I had a recent issue and posted about it where my layout was getting completed after sprite creation so the global variable I set in the layout was not getting applied to the sprite. You can see my recreation with a small bit of code here drive.google.com/file/d/1LYb92WUw8eW_XANYw1TZfcdS3dDYihx7/view I tried to solve this by using a signal (at the end of the layout) & wait for signal (at the beginning of the "on created" sprite code) which did solve the problem with the variable but created a new one.

    My sprites created with a button push are now messed up. I have the first group of sprites created in the layout section and they are fine. The button push sprites are made after those initially created by the layout. They do not have the "on created" code applied to them. I know that section was working prior to this and I can make it work again by removing the signal and wait which fixed my other problem. I have to think that there is some further issue with the order the sections are being executed in. What can I do to resolve this??

    I could post my file but it is huge . . .

    Thanks for your help and advice.

    Kate

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    Update to this issue which I could use help on. The wait for signal worked fine to solve the problem I had but created a new one. Now when I create a sprite on a button push the code in "on create" is not applying to the new sprite (this is the one that waits for the signal from the layout to get started. I know the layout is loaded because I have a bunch of sprites that the code applies to just fine in the layout (they look normal). It is just the new sprites that aren't created in the layout for which the "on create" coding isn't applying . . .

    Help please!

    Kate

  • OK I fixed this by using system>signal in the layout and system>wait for signal in the instance/sprite "on create" code.

  • I can't just move the setting of the global variable into the on_create for the sprite because I want it to stay the same for the whole game and I will be creating multiple sprites.

  • Hmm . . . I thought the code would be executed in order of appearance (my mistake)

    So do I fix this by adding a wait at the beginning of the "on create" for the sprite?

    I tried this and it didn't seem to fix the top statement (which contains my attempt to transfer the variable from global to instance).

    Is there a way to force some code to execute first??

  • Newbie here,

    I have been humming along using instance variables and have found that in order to set a random # I have to put the setting bit of it as a global variable but inside the instance/sprite section of the code. I don't understand why yet but hopefully I will eventually. Then I ran into a roadblock.

    I really need to have a global variable that I set to a rand # at the beginning of the project where I can pass the value to an instance variable. I can set a instance variable = to a global one but then I can't adjust HSL with that instance variable, it only shows global variables as my options. When I use my initially set global variable the adjust doesn't work. You can see my bit of code at the link below.

    I am probably missing something obvious. Thanks for your help.

    https://drive.google.com/file/d/1LYb92WUw8eW_XANYw1TZfcdS3dDYihx7/view?usp=sharing

  • Tarek,

    Thank you so much! You are correct I am getting my Xs & Ys crossed. For some reason I find them a bit confusing. I keep wanting to make the rows into x because they run right to left but x actually denotes the columns. That should definitely set me straight.

    I will also try to implement the for loop to save on computing power. I just thought that if it was a 2D array then I had to use For Each.

    Thanks again for the help.

    Kate

  • Hello all,

    I have searched for this and read the manual but for some reason my code isn't working. I am just trying to find out the x (row) of the array where a value occurs in a certain column (I know the y). I don't have to worry about repeats. Am I doing something wrong??

    Here is my code which I took a screen-shot of because the project itself is huge.

    Basically I am looking for 2 values one is "mal_code" and the other "fem_code" in the first column of the array and am trying to get the x(row) where they occur loaded into the variables "mal_row" and "fem_row"

    Thanks for looking it over and for any advice you might have.

    Kate

    Tagged:

  • Well, I went and tried to reproduce it seperately from the larger program. I rewrote that bit using plain geometric shapes but it doesn't repeat the warning so I must have a bug in my code. Wish me happy hunting!

  • Hmm. . . I have tried adding it both when the global variable is tested for (=1) and in the subevent after the global variable is tested for. Neither seem to make a difference. The warning sprite still pops up when the variable = 2. . . . I will set up a test file and see if I can reproduce the results there (maybe another part of the code is affecting it.

  • Sorry forgot to add project link.

    drive.google.com/file/d/1u72S-ybMeCEF73mBEwwp3a-oOmBVMN4A/view

  • Hi (Relative Newbie here)

    I am trying to get a sprite to show when a condition is met. Specifically I get the value of a variable using system>get on overlap with mouse.x & mouse.y and then copy the individual sprite value to a global variable. Then I test to see if the global variable is a 1 or 2. If it is a 1 there are 2 possible sub-events. In one I pin the sprite and in the other I have a warning sprite become visible with an opacity change. For some reason the second sub-event is applying when the global variable is 2 also. I only want it to apply when global variable = 1. Here is my snippet of code.

    Thanks for any insight you might have.

    Kate

levering_k's avatar

levering_k

Member since 7 Aug, 2022

None one is following levering_k yet!

Trophy Case

  • 2-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

5/44
How to earn trophies