לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read();‎ חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 14-12-2005, 12:30
  san san אינו מחובר  
 
חבר מתאריך: 07.02.05
הודעות: 560
שאלה חשובה(פירוש

תקשיבו יש לי את הקוד הזה (למטה)איך אני עושה שעם יגיעו במובי קליפים
בו נגיד evil1
evil2
evil3
evil4
evil5
אז ירד -5 hp עם יגעו באחד מהם?
כי אני לא יכול לשכפל את הקוד כי אז השחקן יטוס
מישהו יכול לעזור לי?

קוד PHP:
 onClipEvent (load) {
//listen for key presses
downCapture = new Object();
downCapture.onKeyDown = function () {
switch (
Key.getCode()) {
case 
Key.LEFT: left = true; break;
case 
Key.RIGHT: right = true; break;
case 
Key.UP: up = true; break;
case 
Key.DOWN: down = true; break;
}
}
Key.addListener(downCapture);
//listen for key returns
upCapture = new Object();
upCapture.onKeyUp = function () {
switch (
Key.getCode()) {
case 
Key.LEFT: left = false; break;
case 
Key.RIGHT: right = false; break;
case 
Key.UP: up = false; break;
case 
Key.DOWN: down = false; break;
}
};
Key.addListener(upCapture);
rotateBy = 9; //how much we should rotate every frame (L/R key is pressed)
accelleration = 5; //how much we should move every frame (when Up key is pressed)
function radtodeg(deg) { //convert radians to degrees (for later)
return (deg/180) * Math.PI;
}
}
onClipEvent (enterFrame) {
if (
left) { _rotation -= rotateBy } //rotate counter-clockwise
if (right) { _rotation += rotateBy } //rotate clockwise
if (up) {
if (
accelleration < 40) { //if is below accelleration limit then allow to accellerate
accelleration++;
}
//calculate where the car will move to:
angle = _rotation;
angle = radtodeg(angle-90);
by_x = accelleration * Math.cos(angle)
by_y = accelleration * Math.sin(angle)
_x +=by_x //move the car here
_y +=by_y // and here
}
}
 
onClipEvent (enterFrame) {
if (
Key.isDown(key.UP)) {
_y -= +15;
} 
}
onClipEvent (enterFrame) {
if (
Key.isDown(key.DOWN)) {
_y -= -15;
}
}
onClipEvent (enterFrame) {
if (
Key.isDown(key.RIGHT)) {
_x -= -15;
}
}
onClipEvent (enterFrame) {
if (
Key.isDown(key.LEFT)) {
_x -= +15;
}
} 
onClipEvent (enterFrame) {
if(
this.hitTest(_root.evil)){
_root.HP= _root.HP -5
}
 
_root.bar._xscale = _root.HP;
if(
_root.HP == 0){
_root.gotoAndPlay(2);
}
}
onClipEvent (load) {
//listen for key presses
downCapture = new Object();
downCapture.onKeyDown = function () {
switch (
Key.getCode()) {
case 
Key.LEFT: left = true; break;
case 
Key.RIGHT: right = true; break;
case 
Key.UP: up = true; break;
case 
Key.DOWN: down = true; break;
}
}
Key.addListener(downCapture);
//listen for key returns
upCapture = new Object();
upCapture.onKeyUp = function () {
switch (
Key.getCode()) {
case 
Key.LEFT: left = false; break;
case 
Key.RIGHT: right = false; break;
case 
Key.UP: up = false; break;
case 
Key.DOWN: down = false; break;
}
};
Key.addListener(upCapture);
rotateBy = 9; //how much we should rotate every frame (L/R key is pressed)
accelleration = 5; //how much we should move every frame (when Up key is pressed)
function radtodeg(deg) { //convert radians to degrees (for later)
return (deg/180) * Math.PI;
}
}
onClipEvent (enterFrame) {
if (
left) { _rotation -= rotateBy } //rotate counter-clockwise
if (right) { _rotation += rotateBy } //rotate clockwise
if (up) {
if (
accelleration < 40) { //if is below accelleration limit then allow to accellerate
accelleration++;
}
//calculate where the car will move to:
angle = _rotation;
angle = radtodeg(angle-90);
by_x = accelleration * Math.cos(angle)
by_y = accelleration * Math.sin(angle)
_x +=by_x //move the car here
_y +=by_y // and here
}
}
 
onClipEvent (enterFrame) {
if (
Key.isDown(key.UP)) {
_y -= +15;
} 
}
onClipEvent (enterFrame) {
if (
Key.isDown(key.DOWN)) {
_y -= -15;
}
}
onClipEvent (enterFrame) {
if (
Key.isDown(key.RIGHT)) {
_x -= -15;
}
}
onClipEvent (enterFrame) {
if (
Key.isDown(key.LEFT)) {
_x -= +15;
}
} 
onClipEvent (enterFrame) {
if(
this.hitTest(_root.evil1)){
_root.HP= _root.HP -5
}
_root.bar._xscale = _root.HP;
if(
_root.HP == 100){
_root.gotoAndstop
}
} 
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 05:33

הדף נוצר ב 0.24 שניות עם 11 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2026 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר