How do I spawn multiple copies of a Sprite?

0 favourites
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • https://file.io/1GAweOvsidUZ

    I also made some correction to your random logic.

    Please note that for example random(0,10) will generate a random FLOAT number between 0 and 10.

    Which generates numbers such as 0, 1.12478, 4.25176, and additionaly, it can never be 10.

    To generate whole numbers like 1,2,3,4.... you need to use either floor() or ceil() to round to whole numbers.

    For example:

    ceil(random(5)) will generate either 1,2,3,4 or 5

    floor(random(5)) will generate either 0,1,2,3 or 4

    ceil(random(2,5)) will generate either 3,4 or 5

    floor(random(2,5)) will generate either 2,3 or 4

    Overall, your project is extremely inefficient and/or over-complicated.

    Most things you did could be done with much less events and objects.

    I suggest you look into: families, containers, functions, and use animation frames for different enemy types.

    Not for performance reasons, but for you to learn how to do things faster/easier. So you don't have to copy/paste your code for every new dot type.

    Differentiate looks with animation frames, and health or other logic with variables.

    Or use families.

    So instead of repeating click/death logic for each enemy type (in your case 3 times), it could be done by a single function. Within the function read the enemy animation frame and/or type variables to run different actions based on it.

  • Good points Everade :). round() works as well. If you check the debugger, you can see the variable being created, would not be an integer. I've made the same mistake. Because the random() for calling an Animation Frame automatically sets it to an integer, because animation frames can only be integers. But, it's not the same with a Number Variable. You'd also get the best functionality with the paid version. Unlocking Family Objects is a game changer. I haven't looked at the .c3p yet, just booting up for the day.

    EDITS: When I first stated with Construct. I watched a bunch of tutorials for Construct 3, and prototyped about a dozen simple games. Then went on to create my own projects, and read through the Documentation.

    I've since read through most of the Documentation a few times(the entire thing once), and make constant reference to it. Like any skill. The more hours, and practice you put in, the more you learn, the better you get.

    What would take me a week to figure out several months ago, now takes me an hour. Education, experimentation, and fixing any issues over time. Will go a long way to increasing your development skills.

    In the beginning I would start off super simple. Then over time learned about Families, Parent/Child Objects, Containers, etc. Then, went back and minimized the amount of blocks being used. Adding in Functions for areas that were repeating over and over. And, now use Families for just about every type of enemy/object, unless it's a really unique enemy/object. It makes changing states/animations super easy using variables, and also using a single list of behavior/variables over an entire family is much easier.

    You can also isolate objects from a family, by checking if it matches or does not match "FamilyNameHere.ObjectNameType". Then, learn about passing through UID of family objects, to even further isolate objects, if needed within functions. It takes time. The more you learn through practice, the better you get. I'd suggest visiting YouTube, and find some good devs who teach on there. I could point you in the direction of a few who have helped me through their videos, mbuckenmeyer90. Develop a bunch of different style games alongside tutorials, then go on to take those skills into your own project.

    Like any skill. Playing guitar, or a game like golf, Chess, etc, it takes time. Once you get a base set of skills. Then jump in and learn through experimenting with what you know in your own larger project. And, expand on it over time as you learn more and more. It's what has worked for me. And, I'm sure many other developers. With any type of application.

  • Yes round() can be used to round numbers up and down... But that's a problem if you're looking for "equal" random() chances. It won't give you the same results like floor() and ceil().

    I don't recommend using it in combination with random(), because the lowest and highest number have a 50% lower chance to be generated compared to all the others inbetween.

  • brainwavecreations

    You're still overcomplicating the blood splatters. And it doesn't seem like you tested yours.

    • My example uses 1 event, 1 actions. And fixed the random issue.
    • Yours uses 8 events and 29 actions. Random issue still persists.

    While your animation frames are not generated properly due to floating numbers... mine gives you the wanted results. What i just explained about how to use random in conjunction with whole numbers is not applied.

    I highly recommend using my example. I haven't changed the main functionalities, i just fixed it.

  • brainwavecreations

    You're still overcomplicating the blood splatters. And it doesn't seem like you tested yours.

    • My example uses 1 event, 1 actions. And fixed the random issue.
    • Yours uses 8 events and 29 actions. Random issue still persists.

    While your animation frames are not generated properly due to floating numbers... mine gives you the wanted results. What i just explained about how to use random in conjunction with whole numbers is not applied.

    I highly recommend using my example. I haven't changed the main functionalities, i just fixed it.

    Oh shoot. I didn't see the link in your first comment. My bad... I wouldn't have spent my time on this XD. I was just throwing it together as quickly as I could, in the time I have this morning.

    Your example is far better :)

    EDIT: Deleted previous comment, to lessen confusion. Alrighty. Time for me to get to work. Best of luck everyone. I'm always a bit frantic in the morning. I was just patching together a simpler version, of what was going on in the initial example I downloaded this morning.

    Sorry about that, to both of you. Wish I had taken the time, and had seen your original download link to your revised version Everade

    Could be a bit simpler, combining the two revisions. And removing the on left mouse released events. Just my personal opinion. Have it all run under the single left click event. The call of blood splatters is much better using the loop you've got going.

  • Really quick. The combination would look something like this, https://drive.google.com/file/d/16bbrbUHGS_Y7h4vynk0w13jvQox9xhrI/view?usp=sharing

    Just using one EnemySprite, and calling/comparing frames. And then running the splatter loop from your example Everade

    Peace! :)

  • Don't be sorry, we're all just trying to help here. ;)

  • Don't be sorry, we're all just trying to help here. ;)

    Haha, exactly :). Between the two examples, there should be some good ideas, of how to simplify things. In my updated one above, including the loop from yours. It's a just a bit shorter, and uses less Sprites. Calling frames from a single sprite. And, removes the left click released events.

    But, as always, there are always many, many paths to the same outcome :)

    My mind always goes in a hundred different directions first thing in the morning. So many different projects going at once, between games and web development. But, I find helping others here in the community, forces me to think about different things, and tackle different issues that are not within my own projects. Which helps develop knowledge in all different areas of working with Construct.

    Either way. There are many options to get the intended result, whether it be something like this, or creating an edge grab mechanic for a platformer, firing multiple projectiles, etc.

    I really must take a quick breather, then get back to it. Managing server issues, while messing around with this example. If it's not one thing it's another.

    Hope you both have a fantastic day!

    ✌️ & ❤️

  • Wow, the two of you blew up my forum lol I wasn't expecting so much information. Ok, hopefully, I don't miss anything in my reply.

    Everade unfortunately either I missed my opportunity or something is wrong but your link " file.io/1GAweOvsidUZ " says the file was deleted, but I probably wouldn't be able to open it anyway since I don't have a paid version of Construct. Also, I don't know how to set up a repeat/loop (yet). And I can't make families in the free version of Construct so I am attempting to do as much as I can before I decide (if ever) to get the subscription. But thanks for explaining "floor" and "ceil" that is good information to know.

    brainwavecreations I would appreciate it if you could let me know of some good Youtube channels/creators for Construct. I did look once real quick but all I saw were creators for Unity.

    Also, I can't remember at the moment and am not currently looking at the game but I know I originally added the "on left mouse released" bits because before doing so I was getting some unwanted results, and adding that condition seemed to fix it.

    Additionally, I can't open your file from " drive.google.com/file/d/16bbrbUHGS_Y7h4vynk0w13jvQox9xhrI/view " it says you have a newer version than what I have but that's probably from what I had mentioned earlier in this response, that I don't have the subscription.

    I wouldn't mind seeing more screenshots if possible though, that helps me out alot, and then I'd see what I can manage with the free version.

    Welp, I think that's all my key points.

    Thanks for the help!

  • mbuckenmeyer90 - Do you have a good email I can reach out with some YouTube Channel recommendations? I can gather some of the Channel subscriptions from my YouTube account later tonight, or in the morning. If not, I will make another post here in this thread.

    I saved the .c3p files in the latest beta version, "r301" which was just released today. Just be sure to be using the Beta version in your Construct 3 Settings, and it should update itself to r301 automatically.

    The loop that Everade made is included at the bottom of the latest example I uploaded to my Google Drive, incase you have trouble accessing it through the link provided earlier. (It is showing up as been deleted on my end as well, when I try to access the link.) The loop is very simple, and I'm sure you will understand by looking at it, practice using that functionality over time. It's the Event all the way at the bottom of the Event Sheet, which creates the Blood Splatters.

    I made a few small changes as well, like adding a fade effect to the splatters. So they fade then destroy(set with a tick box in the behavior properties) over a set time. The time it takes to fade is changeable in the Fade properties of the behavior on the splatter as well. Also, changed up the background color a bit, so you can see the random angles of the EnemySprite, to be sure they are working properly.

  • Looks like that hoster deletes the file as soon as it has been downloaded ones.

    Here a different file hoster:

    easyupload.io/qn23vh

    Valid for 30 days.

    Please note that this file is also saved in the latest beta version of Construct 3.

    Setting up a "repeat x times" is super easy.

    System -> repeat

    enter how many times

    done.

    Just like on the picture.

  • I updated my Construct and downloaded your versions. Thanks! It'll take me some time to assess these changes and get the information in my brain, I'm slow.

    At first glance, both these changes seem to work, I prefer the faster speed in Everade's, but I was wondering if it's possible to make it so that the blood spatters just created that hit the screen are of the same (animation) frame.

    In other words, if the enemy is destroyed and three splatters are created, can we make sure they look the same.

    (In my mind, I figure that way if the blood sprayed then all the blood would look like it sprayed instead of a spray and a glob/blob.)

  • You can alter the instances of System > Wait Time in the Event Sheet as well. To speed things up. I modified some of them while working on making changes this morning to what you had. I forgot to set them back to what they were originally. My bad XD. It has been a crazy welcome to the new week today.

    Anyways, here's a couple YouTube Channels I highly recommend.

    Xanderwood - He's a great resource, and I've learned a ton from a few of his tutorial series. This is a great place to start. His original Platformer series is fantastic, and covers many areas of Construct 3. Perfect place for beginners to start learning. And, all his videos are concise, and has good flow from video to video. I tried to follow along with certain devs on YouTube when I was just starting out. And, wound up getting super confused because certain Events, Variables, etc, would change between videos.

    https://www.youtube.com/c/XanderwoodGameDev

    FoozleCC - Fore more advanced topics, I highly recommend FoozleCC. Everything from using the latest 3D features of Construct, to complex mathematical formulas. He was slowing down with his YouTube Channel for a while(he had another child). But, the last time I chatted with him online, he was saying he's trying to get regular with the uploads again. I haven't looked over his uploads in a while. I developed the Player State Machine in my current major project, based off of one of his videos. Then, expanded on it, and added a bunch of things on top of it.

    https://www.youtube.com/c/FoozleCC

    Game Design with Reilly - I haven't gone through much of his videos. But, I came across his channel a few times over the past year. I just picked up using Construct 3 again about 10 months ago, but had a 5 month break from it over the Winter, while dealing with other things in life. The videos I have come across, have been solid though :)

    https://www.youtube.com/channel/UC7wehUTim_FmesOi3l2qMQA

    I'll be starting a tutorial series for my current platformer project as well. Showing folks how to build a fairly advanced Platformer game from the ground up. With all sorts of power-ups, falling platforms, etc. Not really anything educational there yet. But, you are welcome to visit whenever. Hope you all don't mind the plug XD. If you do visit, you'll notice I don't have any sound effects yet. I need to spend a day and find decent licensed sound for that part of it. Sound alone adds a lot to gameplay. Especially for one of the latest Player moves I've added, which is a Butt Slam like in Mario. Just added a few things that interact with that ability the end of last week, and today as well.

    https://www.youtube.com/channel/UCVeduuNSqlZqQLbj09w2HAg

    EDIT: I'll leave the question of all splatters be the same for each EnemySprite Destroyed, up to you ;). Unless Everade, or someone else wants to jump in. I've got a busy night/week ahead. Take Care, and best of luck!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll definitely check out those channels. Big thanks for all your help!

  • I'll definitely check out those channels. Big thanks for all your help!

    Sure thing! You got it, (☞ ͡° ͜ʖ ͡°)☞

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