Random Frame Question

Get help using Construct 2

Post » Wed Aug 14, 2013 12:45 am

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!
B
5
Posts: 17
Reputation: 286

Post » Wed Aug 14, 2013 1:17 am

On Frame Changed > Frame Destroy
B
46
S
16
G
79
Posts: 2,171
Reputation: 46,859

Post » Wed Aug 14, 2013 1:23 am

@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
B
46
S
16
G
79
Posts: 2,171
Reputation: 46,859

Post » Wed Aug 14, 2013 1:55 am

@plinkie: 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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,297
Reputation: 70,799

Post » Wed Aug 14, 2013 1:59 am

@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.
B
46
S
16
G
79
Posts: 2,171
Reputation: 46,859

Post » Wed Aug 14, 2013 3:15 am

@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: http://www.nomadicgamesonline.com/Games/cardgame.capxN0M4D2013-08-14 03:18:06
B
5
Posts: 17
Reputation: 286

Post » Wed Aug 14, 2013 8:05 pm

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,297
Reputation: 70,799

Post » Thu Aug 15, 2013 5:13 am

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?
B
5
Posts: 17
Reputation: 286

Post » Thu Aug 15, 2013 5:18 am

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
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Thu Aug 15, 2013 5:29 am

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.
B
5
Posts: 17
Reputation: 286

Next

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], JackTYGA and 30 guests