Majinboo's Forum Posts

  • Arrays are indexed by numbers. CurX is just whatever the current number is in the For loop, for the X dimension.

    So if we have a single dimension array, for the moment, your array would be:

    CurX=0 -> Array(0) -> "triangle"

    CurX=1 -> Array(1) -> "circle"

    CurX=2 -> Array(2) -> "square"

    CurX=3 -> Array(3) -> "rectangle"

    "For each X element" is just setting the value of CurX to those numbers for you. If we introduce two dimensions, then we need to start adding the Y index to get at the appropriate data. Y=0 is our name.

    CurX=0 -> Array(0,0) -> "triangle"

    CurX=1 -> Array(1,0) -> "circle"

    CurX=2 -> Array(2,0) -> "square"

    CurX=3 -> Array(3,0) -> "rectangle"

    Y=1 is our count (assuming some random values for the moment).

    CurX=0 -> Array(0,1) -> 3

    CurX=1 -> Array(1,1) -> 7

    CurX=2 -> Array(2,1) -> 4

    CurX=3 -> Array(3,1) -> 0

    Does that help any?

    Then CurX its to check all X values, you used Y=0 because we only have 1 Y row, if you want to check more Y rows then you need to use CurY, Right? i understand now, thank you!

  • blackhornettechnologies.com/Construct2Stuff/ArrayPickUpFigures_BHT.capx

    Thank so much for helping me, works perfectly, maybe this is a stupid question but i am curious why you cant use X = 0 instead of Array.CurX? cur is for current position right? since a lot of days i am reading several times the manual ( https://www.scirra.com/manual/108/array ) to understand the arrays.

    i am trying to understand your solution:

    For each X element

    - Array.CurX,0 = figures.whatIam// ( the array will find the variable whatIam values in the current X position "X0??", Y0, if i want to find a value in X1 then i don't need use CurX? because CurX everytime its the X0 position? why you dont use curY? )

    --> action: set value at X: Array.CurX, Y: 1 , value = Array.At(Array.CurX,1) + 1 ( at its for retrieve the value of CurX, Y1 ) now i understand this.

    in the manual says:

    CurX

    CurY

    CurZ

    The current zero-based index for each dimension in a For each element loop.

    then CurX = X0 , CurY = Y0 ? maybe i am wrong and Cur isn't means current position, its just the 0 value of X,Y and Z, index its each cell.

  • Thank you for helping me, the array didn't save the triangle and save in the wrong Y position, my array is 4,4,1 because i want to store other different data.

  • somebody help me please...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • After reading a lot of arrays posts and tutorials then i tried to make myself an example of what i understand.

    What i want?? well i have 4 figures ( triangle, circle, square, rectangle ) , every 5 seconds i spawn new figures, i want to pickup the figures and save the number of pickups for each figure ( example i picked up a triangle 2 times, array must save number 2, if i pickup again another triangle array must add +1 ( total saved: 3 ) ).

    I used families because i want to use a lot of different sprite objects, This is my logic:

    Yes, i was bad in mathematics at the school, i tried to use my noob logic here.

    1. on start of layout-> ok i used the ArrayCreator tool, i understand that i need this event each time that i want to use an array.

    3. - For each player ( i think this is bad because i have only 1 player object on screen, maybe must be replaced for each figure object.)

    - Player is overlapping figures -> Add 1 to collected (yes i know this is wrong because when figures are destroyed then the variable collected will be destroyed too) , why i don't used a global variable? because i want to save the number of collected figures for each figure (triangle, circle, square, rectangle), i don't understand what to do here.

    4. For each XY element, contains value figures.whatIam ( i saved the name of each figure in WhatIam variable in each figure object so the array will know which figure you are picking ) --> set value at (Array.Curvalue, 1) to figures.collected ( here i tried to add the value of number of pickups to the array ) but the problem its that the variable collected its destroyed with the figures.

    I used Y1 row: because in Y0 row i have the name of the figures, using the array creator tool i can see that under Y0 Row i have the Y1 row, my question is, the array read the data under Y0 Automatic? example like an excel spreadsheet, because i was thinking in 2D arrays like an excel spreedsheet, example i put in X0, Y1 the number 5 then the array will know that number 5 its the number of triangles because triangle word its in X0,Y0 position, then too the array will know that all values under X0 in all Y positions are secondary values of the Y0 cell?.

    I want to understand and learn, please help me.

    my .capx:

    http://www.filedropper.com/arraypickupfigures

  • i was reading about performance of construct 2, the best way to avoid performance issues is avoiding every tick and physics as much as you can, then my question is if i have a sprite that drops an object which is the best way to do this? with platform behavior or physics? for example my sprite have a weapon, if i kill the sprite then the sprite will drop the weapon sprite, the only way to drop the weapon naturally is with platform behavior or physics in the weapon sprite, i put an example:

    if sprite destroyed -> weapon sprite ( enable physic or platform behavior) , if weapon sprite overlap floor sprite then -> disable physics or platform behavior of weapon sprite.

    The capx:

    http://www.filedropper.com/enemydropweapon

    i am worried about performance issues if i have a lot of sprites on screen dropping weapons etc.. etc.. and of course the AI CPU consumption.

  • Could you share your capx or a screenshot of your code?

    thanks for your help, Now its working, i dont know why but this cant work with sprite fonts or saved letters in an array, the solution was put the same words in an invisible textobject without spritefont or letters saved in an array.

  • Is the code "keyboard (on key code 13 pressed) -> TextObject set text to TextBox.text" works?

    didn't work, i dont know why, in the text object properties obviously "Text" is empty, and the game set the variable with an "empty value" too, this have sense, then my question is how i can save in a variable the typed text of the text object.

  • Perhaps have you set "myword" to Global number instead of Global text?

    its an instance variable type text, i am trying now with a global text with an initial value , when i hit Enter the value of the variable is empty.

  • i have two boxes to test, when i type with my keyboard then in the first sprite box appear the word that i wrote and in the second box my game shows the same word but in a text object, i am trying to save in a variable the word of any of the two boxes without success, after researching i cant found the answer, please help.

    i tried this:

    keyboard (on key code 13 pressed) -> TextObject (set mywords to TextObject.text)

    in the debugger mode the variable value of mywords is 0, if i write some text in the default text value after pressing the key enter the value is set to 0, i dont understand why the word cant be saved.

  • i think i solved it, i just created an empty sprite and i set the position of the empty sprite to the character, then i put the position of the healthbar in the image point "health" of the empty sprite, because the empty sprite dont have animations with different sizes now the healthbar dont move it, if someone have the same problem as me this is the solution.

  • scirra.com/manual/99/pin

    i tried pin before and didn't work because the health bar have the origin point on right side and i cant change it because every damage point will reduce the with of the healthbar, and the healthbar for some reason with pin behavior its on bottom, i want on top, the pin behavior is using the origin point of my animation and all my animations have the origin point on bottom, i cant change it.

  • Please help me, my enemy have working health bar, my only issue is that when my enemy is using another animation the health bar is moving of position too, i want static health bar over the head of my enemy, so my enemy will walk without moving the healthbar too over their head, i am using set position enemy.ImagePointX("health") and enemy.ImagePointY("health") , but my animations have different sizes, i tried to put the same image point position to all my animations and obviously the healthbar is moving with the character then i tried to assign manually the same position of my idle animation ( image point X 47 Y-105 ) to all my animation and didn't work.

    The only way to do this was manually edit the image point with my mouse example X 47 Y-105 is the image point position (health) of my idle animation and X 58 Y -113 is the same static position of the image point in my walk animation, i tried "apply to all animation" option but didn't work, the only way to do this is manually?? i have a lot of animation with different sizes and its very hard do this manually with the mouse because isn't precise, and the position X and Y are different with each animation, i cant just put the same X and Y in all animations.

  • > ... i just want for example write ru and get ?....

    > Majinboo check also:

    thank you so much for your help, your example capx helps me a lot!!!!!! i will read a lot more about arrays, the array editor its amazing! i have a lot to learn! thank you again!!!!!!!!

  • i tried a lot to do this but i cant, i feel like i am dumb understanding programming, please give me a link to understand how to do this, even i tried to replicate this: scirra . com/forum/viewtopic.php?f=147&t=129298&p=909520&hilit=convert+text#p909520 and i cant, i get error in json , i just want for example write ru and get る in a text object, i will make the sprite font of course, right now i can write with the keyboard in my project and get the text in a text object with my sprite font, i just need compare the text with the dictionary variables (ru , tsu, wa, etc..) and get the value る, つ, わ, etc... in a new text object.. like when you write with IME keyboard in windows, you write ru and instantly you get る, i want this but in game without textbox.

    my failed .capx attemp:

    filedropper.com / iamdumb