4 Replies - 2740 Views - Last Post: 31 May 2013 - 09:54 AM

#1 EddyCodd  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-May 13

ActionScript counter inside Movie clip

Posted 30 May 2013 - 01:42 PM

Hello, I am trying to make a game where the score is displayed within the "prey" movie clip, and taking two points off the score when hitTest against the "predator" movie clip.

here is my code -
 prey.onEnterFrame = mover_1;

function mover_1 () { 
if (preditor.hitTest(this)) {
		this.score -=2;		
	}
} 


within the "prey" movie clip I have the code -
 var score.Number; 
score = 20;
score_bar.text = score; 


Now the movie clip displays the score "20", but does not change when hitTest with "predator".
any help would be very appreciated.

This post has been edited by macosxnerd101: 30 May 2013 - 01:43 PM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: ActionScript counter inside Movie clip

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10781
  • View blog
  • Posts: 40,153
  • Joined: 27-December 08

Re: ActionScript counter inside Movie clip

Posted 30 May 2013 - 01:44 PM

Moved to Flash/ActionScript. Also, please use code tags in the future: :code:.
Was This Post Helpful? 0
  • +
  • -

#3 EddyCodd  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-May 13

Re: ActionScript counter inside Movie clip

Posted 30 May 2013 - 02:09 PM

Ah ok, thanks for the edit. Its my first time on this forum. Do you have any suggestions how to make the hitTest recognize a variable inside the a movie clip?
Was This Post Helpful? 0
  • +
  • -

#4 eddiehm  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 76
  • Joined: 09-March 10

Re: ActionScript counter inside Movie clip

Posted 30 May 2013 - 07:51 PM

In your if statement you need to reset the text value of score_bar. as well as updating the value of score.
Was This Post Helpful? 0
  • +
  • -

#5 EddyCodd  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-May 13

Re: ActionScript counter inside Movie clip

Posted 31 May 2013 - 09:54 AM

IT WORKS! thanks for that, iv been going mental trying to make it work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1