Broken Code?

  • Hi

    I recently started making a game similar to that of Pocket Empires. I am just adding the 'battle' code and it now doesn't work. Please could somebody tell me what is wrong with it?: dropbox.com/s/x67waac608jojnk/Test.capx

    The 'battle' code is on the E-Forest event sheet and all my variables are on the E-Menu event sheet.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Though I have yet to play Pocket Empires, interesting concept I must say, Like dungeon crawl.

    I've had a quick look and here's what I found:

    -You have only two cases where it is either PlayerEndHealth (PEH) <EEH and PEH>EEH.

    Since you have no PEH=EEH, as much as you click Fight nothing will happen.

    -That is caused by earlier condition where EEH will always equal to PEH and is 0

    because SHealth=0 and SArmour=0 making them always 0.

    You might want to simplify your code. Try with simpler equations to see if it works

    before going deeper. Perhaps using Function to avoid repeated events too.

    Have fun!

  • You said about an earlier condition where EEH will always equal PEH as well as SHealth and SArmour equalling zero. Where abouts is this condition? I cant remember adding such condition.

    Thanks for the reply though.

  • I figured out why it wasn't working, I was only testing the current layout. For everything to work I had to load the game from the first layout.

    I've now hanged the start variables so it works. The problem now is that after I click fight, the text box which displays the amount of gold just disappears. Any ideas?

    Here is the link to the updated code: dropbox.com/s/x67waac608joj ... .capx?dl=0

  • Yeah, I too figured you might have the variables modified somewhere else.

    But still, since you determined the Fight's result by comparing PEH and EEH,

    there might be times where PEH=EEH as the game progresses. If you have no

    case for it, then that wouldn't do anything. That's what I meant :)

    As for the new capx, the link isn't working to me so please upload it again.

  • I sorted the chance of PEH=EEH and added an event incase it happens. as for the link, idk why it doesn't work.

  • The link you posted is probably okay, it just that you cannot post clickable one yet.

    You can workaround and post the thing behind https://www.dropbox.com/s/

  • It isn't clickable as I don't have the rep. Just copy it into a browser.

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