02-02-2008, 16:18
|
|
|
חבר מתאריך: 30.06.06
הודעות: 243
|
|
[עזרה] אני בונה משחק ואני צריך עזרה בקוד
אני בונה משחק שאסור לגעת באובייקט שנקרא ball ואם נוגעים אז זה מעביר אותך לסצנה הבאה.
עשיתי פקודה שאובייקט ball ישכפל את עצמו מספר פעמים ויפול מלמעלה.
ויש לי בעיה שכשעוברים לסצנה הבאה אז האובייקט ball ממשיך ליפול.
איך אני יכול לבטל את זה שכשיעברו לסצנה הבאה (שיפסלו) אז זה יעצר, סתומרת שאובייקט לא יפול?
זאת הפקודה:
קוד:
objects = 0 // Do not touch this objects counter
speed = 3 // Object's falling speed
time = 1500 //Time between each object create
amount_each = 0 // Amount of objects dropped each time
obj_name = "ball" // Object Name
objects = 0 // Do not touch this objects counter
speed = 2 // Object's falling speed
time = 1500// Time between each object create
amount_each = 1 // Amount of objects dropped each time
obj_name = "ball" // Object Name
function makeobj(obj, rndX, Y, amount) {
for (c = 0; c < amount; c++) {
_root.attachMovie(obj, obj + objects, _root.getNextHighestDepth())
_root[obj + objects]._x = random(rndX)
_root[obj + objects]._y = Y - _root[obj + objects].height
objects++
}
}
setInterval(makeobj, time, obj_name, Stage.width, 0, amount_each)
function checkheight(obj) {
for (i = 0; i < objects + 1; i++) {
if (_root[obj + i].hitTest(_root.star)) {
removeAllandFinish()
}
if (_root[obj + i]._y < (Stage.height - _root[obj + i]._height)) {
_root[obj + i]._y += speed
_root[obj + i]._rotation += speed
}
else {
if (_root[obj + i]._alpha <= 0) {
_root[obj + i].removeMovieClip()
}
else {
_root[obj + i]._alpha--
}
}
}
}
function removeAllandFinish() {
for (object; objects > 0; objects--) {
_root[obj_name + object].removeMovieClip()
}
_root.nextFrame()
}
onEnterFrame = function() {checkheight(obj_name)}
score=0;
|