PDA

View Full Version : Adobe Flash - проблем с написването на скрипт



marto654321
06-26-2010, 09:12
Здравеите.Аз правя игра за телефон , подобна на Brick Breaker, но не мога да се сетя за скрипт на топката .(скрипта трябва да е ActionScript1 и Instance name на топката е mcBall и не мога да пиша МС)
за сега ето това съм измислил но не работи както трябва :
mcBall._x+=10;
mcBall._y+=10;
ballXSpeed:Number = 10;
ballYSpeed:Number = 10;
mcBall._x += ballXSpeed;
mcBall._y += ballYSpeed;
if(mcBall._x >= Stage.width-mcBall._width){

ballXSpeed *= -1;
}
if(mcBall._x <= 0){

ballXSpeed *= -1;
}
if(mcBall._y >= Stage.height-mcBall._height){
ballYSpeed *= -1;
}
if(mcBall._y <= 0){

ballYSpeed *= -1;
}
Не мога да ползвам : var,function и други оператори и функции, които не са от Actionscript1.Благодаря ви предварително!

8)

lmao
06-26-2010, 10:18
това е прост метод за удряне в стени, май като твоето
сравни ги и виж да не си допуснал някоя грешка някъде

public void Move()
{
// If we'll move out of the screen, invert velocity
// Checking right boundary
if (position.X + size.X + velocity.X > screenSize.X)
velocity = new Vector2(-velocity.X, velocity.Y);
// Checking bottom boundary
if (position.Y + size.Y + velocity.Y > screenSize.Y)
velocity = new Vector2(velocity.X, -velocity.Y);
// Checking left boundary
if (position.X + velocity.X < 0)
velocity = new Vector2(-velocity.X, velocity.Y);
// Checking upper boundary
if (position.Y + velocity.Y < 0)
velocity = new Vector2(velocity.X, -velocity.Y);
// Since we adjusted the velocity, just add it to the current position
position += velocity;
}

marto654321
06-26-2010, 17:13
Не стана.
Ето какво ми изписва :
http://prikachi.com/images/436/2267436E.jpg

Ge7OverHere
06-26-2010, 17:18
Така не мога да ти помогна, но ако нямаш проблем със споделянето на сорса мога да опитам.. :)

marto654321
06-26-2010, 19:12
frame1:
stop();
fscommand2("fullscreen", true);
frame2:
mylives=3;//textfield
enemylives=3;//textfield
myship_.x=120;//mc
myship._y=313.5;//mc
enemyship_.x=120;//mc
enemyship_.y=6.5;
frame3:
espeed=2;
distance=1000;
if(Math.sqrt((myship._x-enemysip._x)*(myship._x-enemysip._x)+(myship._y-enemysip._y)*(myship._y-enemysip._y)) < distance){
if(enemyship._x<myship._x){
enemyship._x+=espeed;
}
if(enemyship._x>myship._x){
enemyship._x-=espeed;
}
}
mcBall._x+=10;
mcBall._y+=10;
ballXSpeed:Number = 10;
ballYSpeed:Number = 10;
mcBall._x += ballXSpeed;
mcBall._y += ballYSpeed;
if(mcBall._x >= Stage.width-mcBall._width){

ballXSpeed *= -1;
}
if(mcBall._x <= 0){

ballXSpeed *= -1;
}
if(mcBall._y >= Stage.height-mcBall._height){
ballYSpeed *= -1;
}
if(mcBall._y <= 0){

ballYSpeed *= -1;
}
frame4:
gotoAndPlay(3);
frame5 и тн не са довършени във фреим3 трябва да напиша скрипта на топката.Може да сум изрязал част от сцрипта при pastevaneo.