Majinboo's Recent Forum Activity

  • 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...

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

Majinboo's avatar

Majinboo

Member since 21 Jun, 2015

None one is following Majinboo yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies