Loading a Random Graphic into Active Object During Gameplay

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I'm working on a game that includes some basic RPG elements. It's a 1-on-1 battler. I have enemies divided into difficulty categories (in my head), and I would like when a battle based Frame loads for it to randomly select 1 of 4 enemy graphics (stats are irrelevant for now). I'm aware of the "x chances out of Y" option in the events editor, but how do I go about setting the events so if the result is 1 they see the skeleton image, 2 they see a slime, 3 it's a dragon, etc.

    And the 2nd part of this is when the enemy "appears", they are following a path I created that brings them into the frame, around an object and into the battle area. Do I need to recreate this for every single graphic that might be spawned as a result of the random number, or can I replace a graphic in an active object during runtime?

    I hope this makes sense lol

  • There are different ways to achieve this:

    1- create different actives and add them to the same qualifier,
    store your monsters name in a list or whatever,
    "create by name" the objects selecting random list item,
    code movement for the qualifier so that you can do this only once

    2- "load frame" action allows to load external graphics into an active animation,
    you'll need some sort of routine to load multiple frames and assign them if your monsters are animated

    3- active picture object can also be loaded in runtime, but again, would be still more of a hassle to animate since it shows static images

    a selection of my Fusion examples can be found Please login to see this link.

  • You mean path movement, or "file path" (i.e. for active picture-load images?)

    You can assign a path movement to a qualified object, but not "directly" to the qualifier.

    You can store a "file path" in any alterable string of a qualified object.

    a selection of my Fusion examples can be found Please login to see this link.

  • What I'm trying do is that I want to have a single picture move from out of frame left to out of frame right across the screen when the frame first loads. But I want the picture to be randomly chosen from 1 of 10 images. I just didnt want to have to create 10 different active objects and create the path 10 times, then randomize which one gets dynamically created.I used the clickteam document that shows how to create dynamic objects at runtime, but that demo still had me create 4 active images, set them to not be created at start, and didn't talk about assigning a path just setting it as a bouncing ball movement. I could create the same 10 images and paths and dynamically load one at runtime, but then if I want to add 20 more images later, I have to create 20 more objects, and thats going to be a mess to work with.

    Ideally, in my (object oriented programming) mind, I would have an array of names and images, and randomize picking one at runtime, which would then load SOMEIMAGE X into SOMEOBJECT and then play the path movement assigned to SOMEOBJECT. Then I can layout path movements ONCE and easily just keep adding images as needed.

  • For this result,
    maybe easiest way would be just adding the images as frames of an active object,
    then:

    start of frame
    >>>set "my_frame" alt. value of the active object to random("number_of_images")

    always
    >>> force animation frame to "my_frame"

    Unless you need an external source of images,
    in that case you would better do with the active picture object

    Quote

    Ideally, in my (object oriented programming) mind, I would have an array of names and images, and randomize picking one at runtime, which would then load SOMEIMAGE X into SOMEOBJECT and then play the path movement assigned to SOMEOBJECT. Then I can layout path movements ONCE and easily just keep adding images as needed.

    You can do as you write above,
    but for a better insight, you should provide more informations,
    i.e.
    need to add images in the future (i.e. additional monsters as you create them?)
    number of objects created at runtime or pre-set?
    how many different kind objects would you setup? the difference lies in..? (i.e. type=monster, type=weapon?)
    how many movements? multiple movements for the same objects?
    objects will be animated or static images?

    a selection of my Fusion examples can be found Please login to see this link.

  • This is a very simple frame. There are going to be 3 total animated characters and they are going to all follow a basic left/right path. There will be 2 small sprites on either side of the frame that will walk towards the center and then walk back to their respective side of the screen. The 3rd object is the static image I am going to make appear prior to the "battle" (think of the closeups of each fighters head prior to a match in Street Fighter II). The paths will never change.

    This is actually a quiz game, so there are no weapons or randomizing to be done for attacks. If the player gets the question right, their character moves right (triggering the walking right animation) a sound plays and the enemies health counter goes down by 1. If the answer is wrong, the opposite happens and the player is the one who loses health.

    Thats the entire thing in a nutshell. I just want to be able to randomly decide what monster image is going to appear as a sprite and as a big picture at the very beginning. One path movement for each active item, nothing else. I actually already made a prototype but it's using specific sprite sheets right now. I want to just be able to randomize the graphics that are loaded and I'm confused why so many steps are necessary to randomly load a graphic into an object.

  • Quote

    I want to just be able to randomize the graphics that are loaded and I'm confused why so many steps are necessary to randomly load a graphic into an object.

    I agree, having an handy and intutive GUI as Fusion does can ease a lot of things,
    but sometimes it can make simple things harder to achieve XD

    I'm a little confused too.
    1- you select a monster from a list
    2- you show a big picture of this monster prior to the match
    3- you place a copy of this monser as an active object walking left-right on a preset path
    main question: does it need to be animated? I guess yes.

    If thei're going to be animated AND have multiple animations (staic/walking/attacking?),
    I think you'll have best luck by simply setting:

    a) an active object with predetermined frames (frame1=monster1, frame2=monster2 etc.)
    for the sarting "big picture" thing

    b) creating your actual monsters as animated active objects
    giving them name: monster1, monster2 etc.
    appliying the same qualifier, i.e. "enemy"
    giving them the movement you need with custom actions based on the qualifier (this will allow to change movement later)
    untick "create at start"
    and when you need them just "create by name" with expression "monster" + Str$("monster_ID")

    a selection of my Fusion examples can be found Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!