thoford75
05-09-2007, 10:41 PM
Hey. Im having no luck whatsoever in creating a snooker game in Director. I have created all the images for tables etc and began to code the script.
The game is basically a one ball snooker game with the aim of potting the ball in any pocket. I have two sprites (ball and cue).
The game runs like this.
The user moves the mouse which rotates the cue around the ball - DONE
The user clicks the mouse to set the cue in place - DONE
The user presses SPACE BAR and the ball travels in the direction the cue is facing towards. - THIS IS WHERE I AM HAVING PROBLEMS
so far my code looks like this:
function exitframe(me) {
_global.angle1 = Math.atan((_mouse.mouseV-sprite("cue").locV )/(_mouse.mouseH-sprite("cue").locH ))
if (_mouse.mouseH < sprite("cue").locH) {
sprite("cue").rotation = _global.angle1*180/Math.PI -90
}
else {
sprite("cue").rotation = _global.angle1*180/Math.PI +90
}
}
function beginsprite(me) {
cuelock = 0
}
function exitframe(me) {
if (cuelock == 0) {
_global.angle1 = Math.atan((_mouse.mouseV-sprite("cue").locV )/(_mouse.mouseH-sprite("cue").locH ))
if (_mouse.mouseH < sprite("cue").locH) {
sprite("cue").rotation = _global.angle1*180/Math.PI -90
}
else {
sprite("cue").rotation = _global.angle1*180/Math.PI +90
}
}
if ((cuelock == 1) && (_key.keyPressed(49)) && (_mouse.mouseH < sprite("cue").locH)) {
sprite(2).loch = _global.angle1*180/Math.PI +90
sprite(2).locv = _global.angle1*180/Math.PI +90
}
else {
sprite(2).loch = _global.angle1*180/Math.PI -90
sprite(2).locv = _global.angle1*180/Math.PI -90
}
}
function mouseup(me) {
cuelock = 1
}
function rightmouseup(me) {
cuelock = 0
}
Can anyone help me finish this off asap as its driving me crazy...seriously i wake up in the night with visions of pool tables and angles and maths....
Im willing to negotiate a reward for anyone who can help me complete this game. It needs to be in Javascript for Director MX04 as that is the software im comfortable using.
Thanks
Tom
The game is basically a one ball snooker game with the aim of potting the ball in any pocket. I have two sprites (ball and cue).
The game runs like this.
The user moves the mouse which rotates the cue around the ball - DONE
The user clicks the mouse to set the cue in place - DONE
The user presses SPACE BAR and the ball travels in the direction the cue is facing towards. - THIS IS WHERE I AM HAVING PROBLEMS
so far my code looks like this:
function exitframe(me) {
_global.angle1 = Math.atan((_mouse.mouseV-sprite("cue").locV )/(_mouse.mouseH-sprite("cue").locH ))
if (_mouse.mouseH < sprite("cue").locH) {
sprite("cue").rotation = _global.angle1*180/Math.PI -90
}
else {
sprite("cue").rotation = _global.angle1*180/Math.PI +90
}
}
function beginsprite(me) {
cuelock = 0
}
function exitframe(me) {
if (cuelock == 0) {
_global.angle1 = Math.atan((_mouse.mouseV-sprite("cue").locV )/(_mouse.mouseH-sprite("cue").locH ))
if (_mouse.mouseH < sprite("cue").locH) {
sprite("cue").rotation = _global.angle1*180/Math.PI -90
}
else {
sprite("cue").rotation = _global.angle1*180/Math.PI +90
}
}
if ((cuelock == 1) && (_key.keyPressed(49)) && (_mouse.mouseH < sprite("cue").locH)) {
sprite(2).loch = _global.angle1*180/Math.PI +90
sprite(2).locv = _global.angle1*180/Math.PI +90
}
else {
sprite(2).loch = _global.angle1*180/Math.PI -90
sprite(2).locv = _global.angle1*180/Math.PI -90
}
}
function mouseup(me) {
cuelock = 1
}
function rightmouseup(me) {
cuelock = 0
}
Can anyone help me finish this off asap as its driving me crazy...seriously i wake up in the night with visions of pool tables and angles and maths....
Im willing to negotiate a reward for anyone who can help me complete this game. It needs to be in Javascript for Director MX04 as that is the software im comfortable using.
Thanks
Tom