0 Favourites

[help]Some questions and reflections to think about..

This forum is currently in read-only mode.
  • It's possible create a new sprite that wasn't in the game before executing? It's not a new instance of some sprite that already exist but a newly sprite with empty image and everything..

    Another question is how do I use the 'files' resource of Construct? I add files to it but how do I access it?

    Could be possible create a sprite and load the frame from a file resource? Or I would need to use the plugin resource access?

    and finally.. I have a lot of images that I have to add to the game and they could be accessed from the game.. but not sure the best way(less loadings, more fps, etc) to do it..

    first idea was just make a new sprite for every image to a specific layout and then they could be accessed later from another place during the game...but I think so many sprites with complex images already inside the game wouldn't be a good idea.. so the next idea was making just many blank sprites and access each image from a directory of the game when asked.. the problem is... I'm not sure how many blank sprites I would need, the game would always evolve so the ideal was to find some way that with only sprite show diferent images or hability to create new sprites like mentioned at the beginning of the post..

  • 1.) No, you would need to have an existing sprite object, but you can load the graphics from a file if you are thinking of putting modable graphics in your game.

    2.)I think there is a plugin to provide resource access on the forums, I've not used it however. The built-in resources only work for the XAudio2 plugin (eg: only sound works from resources by default).

    3.)I am doing something similar to this in my game, I created a bunch of blank animations and just loaded graphics into them at run-time. Increasing the number of graphics that can be loaded can be pretty easy, you just add more blank animations. You can call animations like this "Animation(LoopIndex)" when setting an animation meaning a for loop from 1 to Sprite.AnimationCount or something like that will loop through animations (eg: Animation1, Animation2, Animation3)

    Then you just load some graphics into each animation.

  • Yea the animation thing i was trying yesterday and I think I found a yet better way.. just add X frame animations, where X is the number of images you want.. so just make sure the animation doesn't run and select what frame u want to show.. from what I tested, this would be the best way.

    but then comes some other problems... each image could have their own behavior and making by this way.. would be something complicate cuz it's all the same sprite... instead of doing sprite per sprite you could define their own behavior for each one but then again... this would take very long time by adding that much sprite..

  • You can give multiple behaviours, and then deactivate or activate them depending on which animation frame they display.

  • You can give multiple behaviours, and then deactivate or activate them depending on which animation frame they display.

    Ya I though that after.. well.. I think ill give it a try

  • Hey... Do you know a way to get the number of objects with opacity = 100??

    I'm trying

    condition:

    pick 'object' with opacity=100

    action:

    text: set text to object.Count

    but it's getting objects with different opacities too..

  • Maybe just have a private variable that is equal to their opacity as a workaround, and pick by that.

  • Hey... Do you know a way to get the number of objects with opacity = 100??

    I'm trying

    condition:

    pick 'object' with opacity=100

    action:

    text: set text to object.Count

    but it's getting objects with different opacities too..

    object.Count always gives the total number of instances.

    Use CountMatching(object.OID) to get the number of picked objects.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • > Hey... Do you know a way to get the number of objects with opacity = 100??

    > I'm trying

    > condition:

    > pick 'object' with opacity=100

    > action:

    > text: set text to object.Count

    >

    > but it's getting objects with different opacities too..

    >

    object.Count always gives the total number of instances.

    Use CountMatching(object.OID) to get the number of picked objects.

    Thanks! Never took a look at that condition in the system..

  • taking advantage of the topic.. Do u know a way that I could add a object 100 X points after another object of the same instance?

    The layout have 20 objects of the same instance and they all are at the same X and Y, and the game would organize them every 100 x.points? after all of the objects were organized them it would stop?

    I'm trying so many ways to try that but having some dificulties... I already made that by creating the object and get the last one and add more 100 x.points to it but I have to organize them AFTER they were created to work what I'm planning after..

  • If you don't need anything other than single nonanimated sprites without a lot of frills, try uniquesprite. It doesn't do as much as a regular sprite, but might be enough, in the addons section

  • Any1 have any idea how to add 1 value to a variable for each object ordered by X(or anything else but each one must have 1 more value then the last one object)?

    But after they had their value added them it would stop..

    Then they would be organized with X.point by variable*100

    but if one of the objects would be deleted then instead of a 'hole' on the middle, they would be self-organized again.. Not sure if what I'm trying to do is clear in this post..

    I'm having trouble right now trying to re-organize the objects after one is deleted.. any ideas?

  • Any1 have any idea how to add 1 value to a variable for each object ordered by X(or anything else but each one must have 1 more value then the last one object)?

    But after they had their value added them it would stop..

    Then they would be organized with X.point by variable*100

    but if one of the objects would be deleted then instead of a 'hole' on the middle, they would be self-organized again.. Not sure if what I'm trying to do is clear in this post..

    I'm having trouble right now trying to re-organize the objects after one is deleted.. any ideas?

    For each object ordered by x - set variable to loopindex

  • > Any1 have any idea how to add 1 value to a variable for each object ordered by X(or anything else but each one must have 1 more value then the last one object)?

    > But after they had their value added them it would stop..

    > Then they would be organized with X.point by variable*100

    > but if one of the objects would be deleted then instead of a 'hole' on the middle, they would be self-organized again.. Not sure if what I'm trying to do is clear in this post..

    >

    > I'm having trouble right now trying to re-organize the objects after one is deleted.. any ideas?

    >

    For each object ordered by x - set variable to loopindex

    Not sure if i'm doing the right way.. this is the condition:

    For each sprite ordered by Sprite.X ascending: Set Sprite.value to loopindex(loop name)

    what is the name that I have to add?

    edit: Just used loopindex without a loop name and worked, thanks newt

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