-
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
-
Game Master
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.
-
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
-
Game Master
(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.
-
A Senior Newbie - How Odd
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|