Random Frame Question

0 favourites
  • 10 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • I'm testing an idea of mine. I have a sprite with 5 frames and each frame is a different color. I have an event working that will randomly select a frame.

    My question is, once a certain frame is chose, how can I remove it so that if I hit random again, it can no longer be selected? Thanks!

  • On Frame Changed > Frame Destroy

  • N0M4D

    If it is still trying to select the frame when it doesn't exist, based on the logic you already have set up, then please send a link to the .capx file and I will be happy to edit and send it back.

    Thanks

  • : there is no "frame destroy" action.

    A frame in a sprite object can't be destroyed other than during edittime in the image editor.

    In that case I'd probably go with an array representing the frames by their index, and each time the index is used, you delete this index from the array and you go to pick up one of the index left in the array.

    This is a question that has come "often" in the forum, if you do a search you should be able to find topics that explain how to handle the array side of this problem.

  • Kyatric

    Good to know thanks! As I am not really an artist, I have been using single frame sprites so far in my game and haven't looked into the image editor. Sounds cool though.

  • Kyatric

    I mean no disrespect, but I always search the forums first before posting a question. The problem is, I'm an artist not a programmer. I understand things like if statements, events, sub-events, inputs, and things of that nature.

    But for some reason my brain does not wrap around the array concepts. People who are good at math are normally not very good at art, people who are good at art, aren't very good at math. They both use different sides of the brain.

    So when it comes to math, I'd say I'm below average. I can do basic algebra and quadratic equations, but for some reason I'm still not understanding arrays. I'm trying to do something extremely simple that uses an array to help me grasp the concept.

    I went through that Match Game tutorial by MsKittie, but I would be lying if I said I completely understood what she was doing. I'd like to start by learning something easier. Like a deck of cards that contains only four cards and a player gets one random card out of the deck and that card is then removed from the deck.

    Here's my capx file: nomadicgamesonline.com/Games/cardgame.capx

  • Here is an example capx.

    For more explanations of how it works, I strongly suggests you take the time to look through the items listed in the "how do I FAQ" (category "Arrays").

    It takes time, but it's doable.

    And taking the "I'm an artist" excuse is no excuse imo (I'm originally an artist too, it took me years to understand how arrays work too, but if you're serious about making games, it is a tool you absolutely need.)

    Abstraction is not a domain reserved to mathematician, I'd even dare on the opposite I'd expect artists to even behave better in that matter.

    Maths like art are craft which requires practice and effort. Being more at ease in one doesn't mean you can't get "good" in both. It just means it takes perhaps more effort, but it is doable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry if it sounded like an excuse. It's really not. I've been putting 8 hours a day 6 months straight now into one of my projects, I went to the Art Institute studying 3d animation, I now run a company. Believe me, I'm serious.

    I'm taking a break from my main project because like you said, learning arrays is essential for more efficient code and organization.

    I just hate Arrays haha. Like, I can code a card game without it, but I truly need to learn it. I'm just asking a little help.

    Somewhere I read Arrays can be thought of in terms of a spread sheet.

    So if I used my deck example, with the Array height = 4 and width =13?

  • with all due respect, I'm an artist (with the degree and all) and I had no problem with arrays, there are plenty of documentation about them to learn from =P

  • Well maybe I'm just dumber than you. :P And Kyatric, the capx file says you're running 140 and I'm running 139. Couldn't open it and I don't see a 140 download.

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