Problem whit making a sprite switch from movement type

Get help using Construct 2

Post » Fri Mar 18, 2016 9:07 pm

In my project i have a sprite that should begin whit moving around whit the 8 direction movement and then switch back to 8 direction movement. I have succeded whit making it switch from 8 direcrion movement to platform movement but not make it switch back to 8 direction movement. Here is my Construct 2 file. The goal is to make the sprite jump up on to the platform when it switches to the platform movement and jump again when it reaches a sprite in the middle of the platform and then fall down and go back to the 8 direction movement. I have made it so it changes to another animation when it collide whit the sprite in the middle so it can go back to 8 direction movement when it falls from the platform so it won't change directions on collision whit that sprite before that. As it is now it falls from the platform but then get,s stuck and does not move and do what the events make it should. I have tried many things but everything always fail one way or another. You can just give me answer based on what i have written here or you can look into the capx and either fix this or find out what i need to fix. Don't look deeper into the capx then necissary and don't comment on anything unecissary. My capx takes up alot of memory so know you know that and don't need to comment on that.
https://www.dropbox.com/s/hksfcr5hzqtw9 ... .capx?dl=0
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Fri Mar 18, 2016 9:43 pm

I don't have a solution (didn't look at the capx) but maybe a workaround.
If you game would allow it you could just switch players. So every objPlayer looks the same but are actually different objects.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Sat Mar 19, 2016 4:34 am

I know of a few examples you could look at, if you'd like.
One is general eight direction movement behavior (with proper animations) intended for topdown games like Zelda and another is probably what you're looking for, a capx I know of that mixes eight direction with platform behavior (some sort of generic superman, press a key to fly and descent)
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
47
S
24
G
30
Posts: 517
Reputation: 19,464

Post » Sat Mar 19, 2016 5:18 am

Okay so i didn't say the name of the sprite that need to be fixed and which layout it is in and such. It's name is Sprite 255 and it is pinned to Sprite 256. It is in Layout 17 and the events related to it is in Event Sheet 4. To find the events related to it, just search Sprite255 in the Search Bar in the Event Sheet. It is the layout you directly go to when you open the capx so i guess some of you could have assumed which sprite it was but in case you haven't i don't want to read confused answers so i will ignore the answers made up to this point. I will only read answers made after this post. So i hope that should make things clear enough. I hope that you still answer even after this and if your first answer was helpful whitout the information so just post it again.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Sat Mar 19, 2016 5:58 am

It's a little rude to just to entirely ignore suggestions given to you just because they're not the "exact perfect solution" that you're looking for. It's your project and all, yes, but please keep in mind that: people are taking time out of their day to attempt to help you.
People may not have "exact" solutions but there are, more than often, solutions you can easily tweak to get working as desired.

Also, your project is 1 GB in filesize. Let me be frank here: Your +30 layouts open is not efficient in terms of memory. Memory warnings from Construct 2 generally should not be ignored, so keep that in mind. The "Construct 2 has estimated that this project will take X gigabytes of memory" are actually the ones you should look out for, in terms of severity. "8.58993e+009 gigabytes" is pretty serious, as: "e" at the end of said number represents far more than an average 'large' number. That's 8796093022.208 MB. Yes. That translates to 9 Petabytes. That's not a good sign.
It's not just with designing the game in the editor and testing it as I'm going to explain below.

That much memory usage will severely limit the number of devices capable of running your game. If your intention is to eventually make your project commercial or even port it to mobile or certain platforms (online such as Kongregate or desktop with Steam), you need to get that in check. The specs of everyone's computers varies vastly, and a general rule of thumb is to make the assumption that more than half of your userbase will not have top of the line rigs. It's even more so for mobile, since while mobile is vastly growing, mobile's capabilities in terms of raw power still pales in comparison to even a three year old PC.

Also, the memory usage may have to do with the too many sprite objects, other than if you have a handful of objects (say, 15?) will many animations each, such as 20 differently named animations. It's just a hunch though, I might need this project at least somewhat optimized so it won't run so slowly.

If it's that large, people are going to be hesitant in downloading your capx and looking at your code. There's some unwritten etiquette in the "How do I" forum with sharing capxs. Don't give out us a capx over 10 MB in size and try not to give us a cluttered project with unrelated code, just a capx with the isolated problem nearly by itself and anything barebones enough at the core of your system to make things work.

One last thing.
I've been using Construct 2 for four years, so you need to learn how important effective debugging is. It's far better to split your event sheets into different components such as enemy AI, animations, interactive world objects, main core barebone events, etc, so that is far easier to debug what is causing a problem, since you can disable entire event sheets in one go if you keep nearly everything in groups. That's a major key about successfully debugging, pick apart and pull your own code and disable medium or small chunks of it one by one, so you can narrow down your problem and what exact condition block or event is causing it so you can disable/remove it accordingly or attempt to figure out a solution on your own, once you know what it is directly causing it.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
47
S
24
G
30
Posts: 517
Reputation: 19,464

Post » Mon Mar 21, 2016 11:48 am

The thing whit debugging. I have used debug mode alot to great effect. Debugging the layout whit this sprite did help a little but not by much. I found out that i had made a event that made Sprite255 set Direction2s value to 4 so long 8 direction was moving. It is 30 from the start and is supposed to switch to 1 when it has fallsen off the platform and switched from platform movement to 8 direction movement. So making it set 4 constantly clearly hinders that so i erased that event. But Sprite255 still does not work. It is supposed to disable it's platform and go back to 8 direction movement and set Direction2s value to 1 when it collides whit a sprites that it automatically falls on when it falls off the platform. Instead it doesn't disable the platform behavior ans does not set Direction2s value to 1 and it remains at 30. So Sprite255 falls down to the bottom and keeps moving the left into the wall.
Here is a video showing how things turn out. The problem is that Sprite 255 changes to Animation2 whitout anything in the events triggering it. It needs to be in Animation3 for things to work out. Even if i manage to make it so it does not do that it will probably still not work. In this video i am trying to show how things turn out, the events and the sprites related to the events.

https://www.dropbox.com/s/1y457xtg1zf74 ... 8.avi?dl=0
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Wed Mar 23, 2016 5:24 am

Like i said debugging did not work. If it should work so tell me a way to use it in the rigth way. I just want someone to fix this since i can't fix it myself or tell me how i should fix it. I would want a answer.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Wed Mar 23, 2016 5:31 am

I'll see what I can do soon, and will try to find a solution for you ASAP :), but I hope you don't mind if I optimize your capx a little.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
47
S
24
G
30
Posts: 517
Reputation: 19,464

Post » Wed Mar 23, 2016 5:49 am

LaDestitute wrote:I'll see what I can do soon, and will try to find a solution for you ASAP :), but I hope you don't mind if I optimize your capx a little.



What do yo mean whit optimize? i don't want you to do change something major or look deeper into the project then neccissary. But no matter what i happy for help.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Wed Mar 23, 2016 6:18 am

Well, it's just a suggestion but I just wanted to show you some better project management habits. I'm just talking about the memory usage errors (those needed to be fixed, like urgently) I'm experienced, I know methods that are maybe easier, once I get a clear look. Trust me, I make sure I don't break anything, that's a policy of mine. At the bare minimum, I'll try to fix the problem at hand though, given it's your project.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
47
S
24
G
30
Posts: 517
Reputation: 19,464


Return to How do I....?

Who is online

Users browsing this forum: newday198913, rotacak and 5 guests