LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-08-2009, 11:17 PM
driaxx driaxx is offline
Registered User
 
Join Date: Aug 2009
Location: Australia
Posts: 3
Rep Power: 0
driaxx is on a distinguished road
I've made an entire mess of my coding! Need help

I'm making a computer game, and everything was going fine until i tried combining the game file (which i'm making on my Mac) and my intro file (using flash 8 on my PC).

When I pasted the game frames into my intro frames and went to test the game, the character (labeled 'hero') just fell down the page and didn't land on the platform below. The character dies instantly.

This is the ActionScript I had on my 'hero' character:

Quote:
onClipEvent(load){
_root.restart();
s=3;
b = this.getBounds(this);
function move(x,y){
h=false;
if(!_root.map.hitTest(_x+x+b.xmin,_y+y+b.ymin,true )){
if(!_root.map.hitTest(_x+x+b.xmax,_y+y+b.ymin,true )){
if(!_root.map.hitTest(_x+x+b.xmin,_y+y+b.ymax,true )){
if(!_root.map.hitTest(_x+x+b.xmax,_y+y+b.ymax,true )){
_x += x;
_y += y;
h=true;
}
}
}
}
return h;
}
}

onClipEvent(enterFrame){
if (_root.playGame) {
_root.falling = move(0,s);

if(Key.isDown(Key.SPACE) && !_root.falling && !_root.jumping){
_root.score+=10; vel = -12;
_root.jumping = true;
_root.bounceSnd.gotoAndPlay(2);}

if(Key.isDown(Key.LEFT) and _x>20) {
move(-s,0); r=-10;
this.gotoAndStop(2);
this.heroClip.nextFrame();}

if(Key.isDown(Key.RIGHT) and _x<480) {
move(s,0); r=10;
this.gotoAndStop(1);
this.heroClip.nextFrame();}

if(_root.jumping) {
this._rotation=r;
if(vel <= 12){
h = move(0,vel-s);
if(h == false && vel < 0){ vel *= -1;}
vel++;
}
else{
_root.jumping = false;
this._rotation=0;
}
}
}
if(this._y>320) {_root.playGame=false;_root.hero.gotoAndStop(3);}
}
onClipEvent (keyUp) {this.heroClip.stop(); r=0;}

I then briefly skimmed over a tutorial which said that I needed to add a hitTest to make my character recognise the floor. I realized I already had a hitTest but as you can see I changed it around according to the tutorial.

Quote:
onClipEvent(load){
_root.restart();
s=3;
b = this.getBounds(this);
function move(x,y){
h=false;
if(!_root.map.hitTest(this._x, this._y, true)){
if(!_root.map.hitTest(this._x, this._y, true)){
if(!_root.map.hitTest(this._x, this._y, true)){
if(!_root.map.hitTest(this._x, this._y, true)){
_x += x;
_y += y;
h=true;
}
}
}
}
return h;
}
}
In doing this, however, my character now lands on the ground and does not instantly die. Instead, it can not be moved left or right with the arrow keys or even up and down with the space bar.

I have a feeling that the different versions of Flash may have caused a problem (i think I have flash 6 on my Mac), but I'm really new at this and I don't know the difference or how to fix it!

Any help is extremely appreciated, sincerely. Thank you in advanced.
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML5 Coding Tools and Resources to Help You Cut Through The Clutters of Coding FlashMove HTML 5 and Javascript 0 11-26-2011 10:45 AM
Tribute to Steve Jobs - The man that inspired and made wonders FlashMove All Things Apple 0 10-06-2011 03:59 PM
Why Microsoft has made developers horrified about coding for Windows 8 FlashMove SilverLight 0 06-14-2011 12:59 AM
Action script to SWF coding jonnie Flash CS3 / Flash 9 1 09-07-2008 06:06 PM
Page opener coding not working!! juury Newbies 1 09-11-2004 10:32 PM




All times are GMT. The time now is 04:32 AM.