Can you see problems with my code?

Get help using Construct 2

Post » Fri Jan 03, 2014 6:53 pm

[QUOTE=LittleStain] would setting for each walker as topevent above the every x seconds and removing it in the subevents work?[/QUOTE]

nah then it would only fire once.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jan 03, 2014 6:59 pm

@lennaert how do you insert the "else" function, could you be a little more specific. You're dealing with a true noob here...
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Fri Jan 03, 2014 7:00 pm

add event, system event ... I generally then just type the name else, and the selection narrows down to it xD

Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jan 03, 2014 7:02 pm

And then what will be after the else? These are both going to be sub events for the man, for each walker set bullet angle of motion even, right?
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Fri Jan 03, 2014 7:08 pm

yes, the first sub of the for each should be the distance check, if the distance check doesnt pass, it shold use the actions of the else (the actions that came from the second loop)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jan 03, 2014 8:03 pm

@lennaert

OK, so I think I did what you told me too and the walker movement still lags. Here's what it looks like now, does everything look right?

Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Fri Jan 03, 2014 8:51 pm

You could try and add instance variables to the walker, so the set animation doesnt get set every loop.

like, add instance boolean variables: walking = true, and attacking = false

set them accordingly, like, in the first sub, once its walking, set the variable walking to true.

to the distance check, add a check for the boolean is walking, and invert it.

Now, when its bigger then 200, and boolean is walking = false, it will set the animation to walking and the boolean to true.

Do the same principal for the attacking.


In short: by means of boolean sets and checks, prevent the spriter animation from being set every loop.lennaert2014-01-03 20:52:59
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Fri Jan 03, 2014 10:42 pm

Man, this is tougher than I thought it would be. I had an older build where there didn't seem to be so much processor used with basically the same events. Not sure why it changed so much. Thanks for your help, I'm working on it!
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Sat Jan 04, 2014 3:24 pm

@lennaert - thanks for your help. I played around with your suggestions for a while and I was still having the heavy processor draw from the Walker movement so I made a rectangular sprite to represent it. Now it uses hardly any processor, regardless of how many instances there are on screen. Now I'm trying to get my Z order right again and make them move independently but, so far, it's a great improvement.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Sat Jan 04, 2014 11:01 pm

great to hear :D


So you have a problem with the spriter image itself ?

if you get stuck with the problem, just ask around on this forum for helps with the scon files, I've got spriter too, but not much experience there yet, but a lot of other visitors on scirra do :)

Lennaert
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], jbr190 and 36 guests