How do I BoardGame Movement?

  • Hello everyone, I have an example of a board game here. How can I do that if the target position is 24 and the last field but 22 is that the player then moves to field 2 so that he then laps...

    Here is the Example!

    https://drive.google.com/file/d/1zN8ltbbjb98kUAzoHKnSytfTTsz5Ky9P/view?usp=sharing

  • There is probably an easier/better way to handle all the movement but I adjusted your example.

    I marked the changes with a red dot. For understanding developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator

    It´s basically just a shorter way of doing an IF statement.

  • Doenst work for me =( if the target position > 20 the player moves endless without stopping

    Note* i have changed the maximum fields to 20

    Full Player Code

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No idea, here´s the file. Works fine for me. Maybe you forgot to adjust one of the variables in the board fields when you changed it to 20?

    wackytoaster.at/parachute/Boardgame%20Movement.c3p

  • btw auf Deutsch ist es für mich leichter :D... Du hast vorhin erwähnt es würde eine einfachere Methode geben um sich auf einem Spielfeld zu bewegen... Ich werde mir aber mal dein beispiel anschauen! Danke schon mal!

    btw in German it is easier for me: D ... You mentioned earlier that there would be an easier way to move around on a field ... but I will take a look at your example! Thanks in advance!

  • Heh ok, allerdings mögen die Mods das nicht weil das ein englischsprachiges Forum ist, bzw. sollte man zumindest eine Übersetzung auch machen, und wenns nur Google Translate ist. Was ich mit einfacher meinte ist eigentlich nur dass es ein paar Sachen gibt die ich nicht ganz nachvollziehn kann. Z.B. sehe ich keinen Grund wieso du PositionN und PositionT in den Board Instanzen hast, das gehört für mich definitiv in die Player Instanz. Und auch das "Player is overlapping Board" ist nicht optimal, es funktioniert zwar, läuft aber auch grundlos 60 Mal die Sekunde. Ist für moderne PCs und sogar Handys meist egal, aber bei Handys kann es dann doch leichter passieren dass es mal zuviel wird und du fps Einbrüche hast. Vor allem wenn es mehrere solche Stellen im Code gibt die vielleicht auch noch mehr machen als nur Variablen zu setzen.

    ---

    Heh ok, although the Mods don´t like that since this is an english Forum and you should at least add a translation, even if it´s just with Google Translate. What I meant with easier is just that there are some things that I don´t fully understand. E.G. I don´t see a reason why you have PositionN and PositionT in the board instances, for me this defenitely belongs into the player instance. And the "Player is overlapping Board" is not optimal, it may work but it needlessly runs 60 times per second. For modern PCs and even phones this mostly doesn´t matter, but with phones you can eventually still run into fps drops. Especially if you have several cases in the code that do this that may also do more work than to just set some variables.

  • Ok thanks for reply... could you give me an c3p example of how you would implement it?

  • Something like this wackytoaster.at/parachute/Board.c3p

    I also changed the diceroll to choose(1,2,3,4,5,6) instead of round(random(1,6)). The reason is that with round(random(1,6)) you are actually less likely to get 1 or 6. Anything from 1 to 1.4999 will result in 1, so a range of ~0.5 where anything from 1.5 to 2.4999 will result in 2, so a range of ~1. Same for 6.

  • Thank you so much! So simple but very effective!

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