A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Game

  1. #1
    Junior Member
    Join Date
    Feb 2006
    Posts
    2

    Game

    Hi Can someone help me making my game?
    i would like to know how i can get an image (character) move where i click on the screen and also restrict the area where he can go and where he cant............thank you

    STVZ

  2. #2
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    474
    I suggest starting simpilar, look at examples and get used to the program. This question is a little vague (not specific) to answer. We will help you with certain things but not making a whole game. Please check out tutorials and game samples, then I can easily explain how to do what your asking for. Sorry its just hard to explain stuff when I have to go over each detail.
    BC

  3. #3
    Junior Member
    Join Date
    Feb 2006
    Posts
    2

    not too vague

    it's not too vague and i cant find the answer anywhere.....
    look think of a bedroom background, i have another picture on it (it's my character) ..i want him to move where i click with my mouse but i don't want him to be able to walk through his bed or his cat or things like that.....................u see?
    thank u

    STVZ

  4. #4
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    474
    (sigh), ok but if you dont understand this its not my fault. Ok, two vars in the starting script called mouseposy and mouseposx, have them equal the cords where you want your character to start. Make a script run every 2 or so frames saying:

    if (yourdude.x>mouseposx){
    yourdude.x-=1
    }
    if (yourdude.y>mouseposy){
    yourdude.y-=1
    }
    if (yourdude.x<mouseposx){
    yourdude.x+=1
    }
    if (yourdude.y<mouseposy){
    yourdude.y+=1
    }

    Then make a mouse element, have a script in it under "on click" saying:

    mouseposx=mouseX()
    mouseposy=mouseY()

    That way everytime you click it will make the two vars equal wherever your mouse is. The other script says that if the vars and the dudes cords are not equal, move them til they are.

    For the not touching stuff I would say make a script saying:

    if (yourdude.collideRect(bed)){
    mouseposx=yourdude.x
    mouseposy=yourdude.y
    }


    There are proboly many sytax errors in this so dont copy paste those exact codes. Hope this helped.
    BC

  5. #5
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    Hiya,

    Do you know how to create an element and assign properties to it?
    Do you know how to change the x and y co-ordinates of that element with mouse clicks?
    Do you know how to make a script run every frame to check the x and y co-ordinates of the element?
    Do you know how to make the script set the x and y properties back outside the boundaries of the objects you don't want the character to be able to be placed in?

    If so, then you know exactly how to do it already

    If not, ask us which ones you can't do, and we can try to help

    Cheers,

    M.
    Please note that my domain has changed to http://www.morganmultinational.com

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

HTML5 Development Center