Results 1 to 3 of 3

Thread: Need help with cutting/pasting my code

  1. #1

    Thread Starter
    Junior Member rastin's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    26

    Arrow Need help with cutting/pasting my code

    Hi,
    Thanks all for helping me with my game so far.

    I've made a small board game which includes player one only (inc code as well for him to help with making code for player 2).

    I've also set up player 2's icons and labels etc...but not sure what code to make for him to work in the same way

    I’m sure that most of player 2’s code can be cut and pasted from player 1’s but I’m not sure which parts.

    How can I make player 2 work in the game?

    If it's not possible is there another easier way I could include a 2nd player in the game.

    (.zip file is in my other post which has 90% of the game completed) . Just look for rastin if there is any problems finding it.

    Hope this can help and many thanks again.


    Rastin

  2. #2
    AIS_DK
    Guest
    OK, Rastin

    I'll be mercyfull and have a look at your game. Don't expect to Get it back the same way, you wrote it, though.

  3. #3
    AIS_DK
    Guest
    OK, I had a look.

    I don't wan't to change you code, since it would confuse you more then help you.

    You are right, that most of the code used to move player one, can be reused to move player two. Here it would be great if you lnew OOP - Object Oriented Programming (search on that sometime, have a look at it).

    But let's not take it that fare yet.

    1. Create a varible called something like "PlayerTwoPlaying" and declare it a a boolean.

    When it's player one's turn the value of the varible should be false, and when player two is playing then is should be true.

    When ever somebody has rolled the dice, check this varible and acordingly enable the right image.
    That is:
    Code:
    if PlayerTwoPlaying then 
      image4.enabled = true
    else
      image5.enabled = true
    end if
    When ever a player has finished moving (his moves are up) change the value of the varible by using:
    Code:
    PlayerTwoPlaying = not PlayerTwoPlaying
    This changes true to false and false to true, nice

    When it comes to the move code for the players I would start out with just placing the players in each corner of the field, that way you won't have to check to see if there already is a player in the field you are moving to.

    This should more or less cover your questions. I hope. See if you can't work your way through it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width