기초 플래시 강좌 - 액션 스크립트3 정보
기타 기초 플래시 강좌 - 액션 스크립트3
첨부파일
본문
자 이번3에서도 앞서 1,2탄과 같은 내용에 약간의 응용만 한것입니다.
이제는 스테이지를 벗어나지 못하도록 막아봅시다.
참고로 이것은 실제 사용하는 소스가 아닌 이해도를 높히는 소스입니다.
차원이 높은 스크립트를 써야하지만 아직은 무리겠지요 ㅎㅎ
심벌을 중심으로 바깥으로 나가지 못하게 합니다.
아래 스크립트2에서 추가해봅시다.
_root.l_u_b.onRelease=function(){
_root.ggamagi._x-=10;
_root.ggamagi._y-=10;
_root.ggamagi._rotation=300;
if(_root.ggamagi._x<=0 ){
_root.ggamagi._x+=10;
}
if(_root.ggamagi._y<=0 ){
_root.ggamagi._y+=10;
}
}
_root.r_u_d.onRelease=function(){
_root.ggamagi._x+=10;
_root.ggamagi._y-=10;
_root.ggamagi._rotation=60;
if(_root.ggamagi._x>=500 ){
_root.ggamagi._x-=10;
}
if(_root.ggamagi._y<=0 ){
_root.ggamagi._y+=10;
}
}
_root.l_d_b.onRelease=function(){
_root.ggamagi._x-=10;
_root.ggamagi._y+=10;
_root.ggamagi._rotation=210;
if(_root.ggamagi._x<=0 ){
_root.ggamagi._x+=10;
}
if(_root.ggamagi._y>=400 ){
_root.ggamagi._y-=10;
}
}
_root.r_d_b.onRelease=function(){
_root.ggamagi._x+=10;
_root.ggamagi._y+=10;
_root.ggamagi._rotation=120;
if(_root.ggamagi._x>=500 ){
_root.ggamagi._x-=10;
}
if(_root.ggamagi._y>=400 ){
_root.ggamagi._y-=10;
}
}
이제는 스테이지를 벗어나지 못하도록 막아봅시다.
참고로 이것은 실제 사용하는 소스가 아닌 이해도를 높히는 소스입니다.
차원이 높은 스크립트를 써야하지만 아직은 무리겠지요 ㅎㅎ
심벌을 중심으로 바깥으로 나가지 못하게 합니다.
아래 스크립트2에서 추가해봅시다.
_root.l_u_b.onRelease=function(){
_root.ggamagi._x-=10;
_root.ggamagi._y-=10;
_root.ggamagi._rotation=300;
if(_root.ggamagi._x<=0 ){
_root.ggamagi._x+=10;
}
if(_root.ggamagi._y<=0 ){
_root.ggamagi._y+=10;
}
}
_root.r_u_d.onRelease=function(){
_root.ggamagi._x+=10;
_root.ggamagi._y-=10;
_root.ggamagi._rotation=60;
if(_root.ggamagi._x>=500 ){
_root.ggamagi._x-=10;
}
if(_root.ggamagi._y<=0 ){
_root.ggamagi._y+=10;
}
}
_root.l_d_b.onRelease=function(){
_root.ggamagi._x-=10;
_root.ggamagi._y+=10;
_root.ggamagi._rotation=210;
if(_root.ggamagi._x<=0 ){
_root.ggamagi._x+=10;
}
if(_root.ggamagi._y>=400 ){
_root.ggamagi._y-=10;
}
}
_root.r_d_b.onRelease=function(){
_root.ggamagi._x+=10;
_root.ggamagi._y+=10;
_root.ggamagi._rotation=120;
if(_root.ggamagi._x>=500 ){
_root.ggamagi._x-=10;
}
if(_root.ggamagi._y>=400 ){
_root.ggamagi._y-=10;
}
}
추천
0
0
댓글 전체