How do I make one sprite contains a random characters ?

From the Asset Store
120 Epic Fire FX Animations + 2 Bonus Characters. Contains 3000+ frames and a lot of Pixel Art Sprites
  • hello, I made a list for all my characters and given them index from 0 to 9,

    so on the start of the layout you will obtain one character then you unlock the character and i want it to be removed from the list so i made a global variable called random_character = 0, and floor(random(RanCharArray.Width)) then create object from random_character and set the x and y.then delete random_character from an array x-axis.

    but its not working please guys can someone help me.

    thank you :)

  • There's too much here to guess where it went wrong, it could be at any stage. Best you put your own logging in and see which values come out incorrectly then you can share the events and tell us exactly where the problem is.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 2 days trying to do it, i need to shut down my brain XD

  • Share the file if you want, I can debug it. Share something :D

  • Share the file if you want, I can debug it. Share something :D

    can you please make me a demo showing me the right way to do it ?

  • What you described seems fine, there must be a problem with the events somewhere but noone can guess this

  • another though, maybe you create only one character, but change it by changing the animation or animation frame?

  • another though, maybe you create only one character, but change it by changing the animation or animation frame?

    thats what i did :) and each frame from 0 to 9 set.

    so picture one saved in the array as 0 and so on till 9.

    then Variable = 0

    Variable = floor(random(RanChibiArray.Width)).

    Create object from the Variable.

    Delete index from Variable.

  • another though, maybe you create only one character, but change it by changing the animation or animation frame?

    dropbox.com/s/h2k8qivm1eeoc98/Untitled.png

  • What you described seems fine, there must be a problem with the events somewhere but noone can guess this

    dropbox.com/s/h2k8qivm1eeoc98/Untitled.png

  • I'm confused by your screenshot.

    You save a random number in random_chibi.

    But after that it looks like you don't do anything with it anymore.

    I think what you're missing is a string variable for instance called "x"

    and then set x = RanChibiArray.At(random_chibi)

    Create object x at layer 0 ....

    but maybe i'm missing the point.

  • It's create object array.at("random_chibi"). remember "random_chibi" is just a number.

  • It's create object array.at("random_chibi"). remember "random_chibi" is just a number.

    yeah a number linked to link it with the array since the frames of my sprite are 10 from 0 to 9 so array value = 0 is set to a frame as i mention above.

    sadly its not creating a sprite T_T

  • yeah,

    but the problem lies in your Create Object action. You don't tell it anywhere to lookup the name of the object type in the array.

    If you want more info on how to work with arrays, one of my tutorials on my youtube channel might help. Not in this particular case of course, but just to get a grasp on how to use them using an example.

    For example: sudoko

    youtu.be/Rq0iQGcVQtc

    or tetris

    youtu.be/fMtO7q1Wrus

  • > It's create object array.at("random_chibi"). remember "random_chibi" is just a number.

    yeah a number linked to link it with the array since the frames of my sprite are 10 from 0 to 9 so array value = 0 is set to a frame as i mention above.

    sadly its not creating a sprite T_T

    Did you replace the logic as I mentioned?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)