Decreasing Var's on hittest

  • Jummm
  • Novice
  • Novice
  • No Avatar
  • Joined: Sep 11, 2006
  • Posts: 17
  • Status: Offline

Post February 26th, 2007, 1:49 pm

Im making a defense game, i have the defense (castle thing) on the right, i have my "enemy" going right, part of the enemys code is the folowing:

onClipEvent (load) {
_root.speed = 3;
}
onClipEvent(enterFrame){
if(this.hitTest(_root.defense))
{ _root.speed -= 2
} }
onClipEvent (enterFrame) {
this._x-=-speed

}

So i got my dude going right at 3 pixals every frame, "defense" is the instance of a movie clip on the main stage, its ment to be a trench to slow down enemys, but the enemys speed doesnt change once it touch's "defense"

Is the actionscript have a mistake init? wrong way round? It doesnt report any mistake when i test the game...

Help please
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 26th, 2007, 1:49 pm

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post February 27th, 2007, 12:35 am

Code: [ Select ]
onClipEvent (enterFrame) {

this._x-=-_root.speed;

}
  1. onClipEvent (enterFrame) {
  2. this._x-=-_root.speed;
  3. }
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.