Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-17-2010, 04:23 AM   #1
Rabbel
Registered User
 
Join Date: Nov 2010
Posts: 2
Default TypeError: Error #1010?

Hi, struggling programming student here. I am making a game where you click on people to have them fall and land on a building. I can not get collision detection to work. I have 3 different people with the different instance names but its the same movieclip, they have "states" and i use a switch case break system for their moving(falling) function.

I get the TypeError: Error #1010 when I use this code to detect collision with the building movieclip, the game gets weird and wont work properly.

function DudeMove (dude:MovieClip):void
{

var gravity:Number = 0.08;
switch(dude.State)
{
case CLINGING:

dude.x = Choppah_MC.x+ dude.pos;
dude.y = Choppah_MC.y + ((Choppah_MC.height * 0.5) - 10);

break;

case FALLING:
//dude.addEventListener(MouseEvent.MOUSE_DOWN);


dude.removeEventListener(MouseEvent.MOUSE_DOWN, fall_begin);
//dude.velocity = Choppah_MC.velocity;
//dude.first_fall = false;

if(Choppah_MC.velocity.x > 0) { wind_force.x = -wind_force.x; }



dude.velocity.x += wind_force.x;
dude.velocity.y += wind_force.y;

//Gravity
dude.velocity.y += gravity;

dude.x += dude.velocity.x;
dude.y += dude.velocity.y;

if (dude.target.hitTestObject(building_MC))
{
trace("collision");
}
break;
Rabbel is offline   Reply With Quote
Old 11-17-2010, 04:48 AM   #2
Rabbel
Registered User
 
Join Date: Nov 2010
Posts: 2
Default [AS3] TypeError: Error #1010 when i try to detect collision

Hi, struggling programming student here. I am making a game where you click on people to have them fall and land on a building. I can not get collision detection to work. I have 3 different people with the different instance names but its the same movieclip, they have "states" and i use a switch case break system for their moving(falling) function.

I get the TypeError: Error #1010 when I use this code to detect collision with the building movieclip, the game gets weird and wont work properly.

function DudeMove (dude:MovieClip):void
{

var gravity:Number = 0.08;
switch(dude.State)
{
case CLINGING:

dude.x = Choppah_MC.x+ dude.pos;
dude.y = Choppah_MC.y + ((Choppah_MC.height * 0.5) - 10);

break;

case FALLING:
//dude.addEventListener(MouseEvent.MOUSE_DOWN);


dude.removeEventListener(MouseEvent.MOUSE_DOWN, fall_begin);
//dude.velocity = Choppah_MC.velocity;
//dude.first_fall = false;

if(Choppah_MC.velocity.x > 0) { wind_force.x = -wind_force.x; }



dude.velocity.x += wind_force.x;
dude.velocity.y += wind_force.y;

//Gravity
dude.velocity.y += gravity;

dude.x += dude.velocity.x;
dude.y += dude.velocity.y;

if (dude.target.hitTestObject(building_MC))
{
trace("collision");
}
break;
Rabbel is offline   Reply With Quote
Old 11-17-2010, 03:44 PM   #3
rrh
throw a trace() in there
 
Join Date: Dec 2006
Posts: 1,982
Default

Ugh. What does the error say after #1010? Errors aren't just obstacles to get around, they are clues as to the nature of the problem.

I Googled your error number, and it's apparently, "A term is undefined and has no properties." So your next step is find out which term is undefined, "dude" "dude.target" or "building_MC" then check the places where you thought you were defining them, etc.
rrh is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump


All times are GMT. The time now is 03:24 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.