Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Flash Overhead RPG Tutorial - Part 6 - Enemy attacking every 3 seconds

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,343
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 17, 2009

SOURCE FILE AND HD VIDEO WILL BE AT...
http://adobeflashtutorials.tk/

In this tutorial I will be showing you how to make it so that you are attacked by your enemy every 3 seconds.

--------ACTIONSCRIPT--------

On the enemy
++++++++++++++++
onClipEvent (load) {
_root.score = 0;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.toon.toonattack.toonrange)) {
this.gotoAndPlay(2);
_root.score += 1;
}
if (this.hitTest(_root.toon._x, _root.toon._y, true)) {
this.gotoAndStop(8)
}
}
++++++++++++++++

On the 8th frame of the enemy
++++++++++++++++
myTimer
function wait(){
_root.hpvar -=1
}
myTimer = setInterval (wait, 3000)
++++++++++++++++

Source: [okay, I've gotta start to do this :P]

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (AdobeFlashTutorials)

  • Sorry about the yelling in the background. o.O

see all

All Comments (16)

Sign In or Sign Up now to post a comment!
  • On today's technology.. every kid thinks it's a professional gaming-programmer.. wow... technology gives a little and took off a LOT...

    SPECTRUM PLEASE COME BACK!

  • I realise this video is a few years old.

    First off, great tutorials.

    With the enemy dealing damage to the player every 3 seconds:

    The current version of flash is CS5 Professional. I usually use Action Script 3.0 for making my games, and I've found it's easier to use timers from code snippets.

    Notice: Do not put a lot of operations into a single timer, or it creates massive lag on your game. It is also not a good idea to make 1 timer 'tick' last 1 millisecond.

  • @DragonReignLLC yeah, i did that.

  • i think you should put unloadMovie(this); in the enemy so you wont lose hp when you go to the same spot where the enemy was after it dies.

  • You should make an enemy following the character tutorial......

  • awesome tutorial when are u going to make part 7 i don't think ites out yet

  • If you touch it once, then move away, it'll continue to sap 1 hp every 3 seconds.

  • also is there a way to ad a "damaged" state?

    ^^; sorry for the questions

  • how do you add a win /lose scene

    I've tried many ways , this one worked for a few games I pieced together but not here:

    if(_root.ehealth < 0){ //It equals 0 _root.ehealth = 0; onEnterFrame = function(){

    _root.ehealth==0?gotoAndStop(2­):0}

    }

    else if(_root.health < 0){ //It equals 0 _root.health = 0; onEnterFrame = function(){

    _root.health==0?gotoAndStop(3)­:0}

    }

    }

    maybe it was sth eplace i put it. took me days to figure this set of statements

  • its the range of how close you can be to the enemy to attack them with it.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more