Can anyone help me make a game? I am new to flash.

23 posts

Flag Post

I want to make a basic defense game. I have the idea all written out, still drawing all the enemies, and I working on a list of weapons. The main problem is that I need help coding. I know a lot about Flash Mx Pro, but not about coding. I learn quick though, but I need someone to help through every step. If no one on this site can help, is there another site I should go to?

I know this is really crappy, but this is as far as I got today:
http://img75.imageshack.us/my.php?image=turretgamehd6.swf

 
Flag Post

My suggestion is to purchase a good Flash/ActionScript book and go from there. It’s much better in the long run for you to understand the broad programming concepts rather than being taught how to do it step-by-step.

With that said, if you have specific questions about programming (i.e. “how can I move my character left and right around the stage?” or “How can I make my guy shoot stuff?”), I’m sure many people here are willing to point you to the right direction.

Cheers.

 
Flag Post

Alright, thank you. I am currantly reading some a.s. online, but I can’t figure out two things for now. Hit detection and angling my bullets with the angle of the imaginary gun. My currant swf:

http://img207.imageshack.us/my.php?image=turretgamerw4.swf

 
Flag Post

I have an affinity towards imageshack.us, I can’t load the friggin’ images.

Try using:

<img src=picture URL>

For hit detection, read hitTest, it’s basic but good enough for hit detection.

 
Flag Post

I suggest you use http://www.tutorialized.com/tutorials/Flash/1 it has many ways to explain how to make games.

 
Flag Post

Alright thanks. I got 3 things right now that I need help with. Here is my currant version:
http://img297.imageshack.us/my.php?image=turretgamedz9.swf

The first this is I want to do is instead of attaching a arm to my character, I want every gun to be a separate arm that attaches to it and where ever the character moves, the arm stays attached.

The second is to have the bullet angle to be equal to the arm.

Last I want the bullet to do damage to the enemy and reset when it hits the enemy. And

I’ve checked most of the tutorials on a lot of sites, but I can’t find any info that I need.

 
Flag Post

For your first question: once the hand detaches, where does it go? Does it go to the starting point? Does it stay where the character stops? What is the purpose of detaching the arm? Once your character stops, do you get to move the arm?

For your second question: this may help (some trigonometry): http://www.19.5degs.com/element/215.php. Once you determine the mouse angle, you can then set your bullets to the same angle.

For your third question: The concept is similar to keeping the score whenever there’s a hit event, but in this case, it subtracts a set amount of health from the character’s total health and when that health variable gets to less than or equal to 0, an event happens (i.e. the enemy dies or disappears).

Here’s a quick and dirty sniplet of code that illustrates this concept (not tested, may have syntax errors, but the concept is more important):

So you have two movieclips: One is your bullet (we’ll call it —> creatively enough, “bullet” with an instance name “bullet”) and one is your enemy (Surprise! we’ll call it “enemy” with an instance name “enemy”). Also, you decided to put this AS code in your enemy movie clip.

onClipEvent ( load ) {
  myHealth = 100; //we start with 100 health
}


//if the bullet hits this movie clip, subtract 10 health from the variable myHealth
onClipEvent ( enterFrame ) {
     if(this.hitTest(_root.bullet)) { 
         myHealth-=10;
     }


    //once myHealth is equal or less than 0, an event happens
    if( myHealth <= 0 ) {
          ....something happens like the character dies...
    }
}

As for the bullet resetting, I guess you can just set the bullet coordinates back to it’s initial launching point (set a couple of global variables to the current _x and _y coordinates when a bullet is launched… i.e. when an event like clicking the mouse to fire the weapon happens) and when it hits the enemy or goes over your stage’s boundaries, you set the bullet position to the initial launching point position. But I think the best way is to have multiple instances of your bullet movie clip and just remove it when it hits the enemy or goes off the stage, that way you can have multiple bullets in the stage. (I hope I understood the question correctly).

 
Flag Post

ok I’ve a similar problem with firing missiles at a certain angle, I understand the trigonometry, so when the movieclip is created with attachMovie I can set it’s ._rotation, but then what do you do to update and move the movieclip in a straight line at that initial angle?

 
Flag Post

Ok I figured it out :-)

Use Math.atan to find the initial angle when the movieclip is created, then when you want to find the dx and dy properties for the function to move the movieclip, use Math.cos and Math.sin for dx and dy respectively, and add these values to it’s _x and _y.

 
Flag Post

Alright, well I’ve ran into some more problems. Lol:

http://img218.imageshack.us/my.php?image=turretgamevn0.swf

Some how I messed up angling the mouse. I got the enemies to lose health, but the bullets keep going, sorta. How do I get the enemies to reset, like where would I go to read a tutorial or something?

 
Flag Post

look up removeMovieClip(). see if that works.

 
Flag Post

Do you know where I can find a good tutorial? I know what removeMovieClip does but i don’t know how to properly script it into my coding.

 
Flag Post

the syntax in ActionScript is:

movieClip.removeMovieClip();

where movieClip is the thing you’re trying to remove. If you put the code inside the movieclip, then you can use

this.removeMovieClip();
 
Flag Post

Alright thanks. I have two more problems. How do I make each enemy have 100hp, intead of all of them having collective 100hp?

Here is a preview:
http://img241.imageshack.us/my.php?image=turretgamecv2.swf

 
Flag Post

When you Duplicated the MC have the HP assigned to the MC name as a variable to track the HPs
off my head its: That will attach a variable called HP as a local variable to the Movieclip.

mcname.Hp:Number 100

Then you need to write in the movie function have it read the HP variable as a local varible using the this.Hp
or parse the MC name. (but rusty atm)

 
Flag Post

tivaelydoc: P.S. your cursor is below your enemies, make sure that it’s always above everything.

 
Flag Post

Before I change the cursor, I need to get the bullet firing and angling correct, which I still can’t figure out.

 
Flag Post

Looks like were making the same kinda game

Iam using an optimised code function for this.
(code shows basic face mouse function)

root.onEnterFrame = function () {
// Rotations
angle = Math.atan2((xmouse – mcplayer.x), (-1*(ymouse – mcplayer.y)) )*180/Math.PI;
mcplayer.
rotation = angle;
}

hmmmm anyone know have to use hard brackets ?
In old actionscipt 1 formating it would look something like. Iam sure that changes to Actionscript two theres an easier and much more efficent way of doing this ?
(function will automaticly rotate any designated mcname and have that mcrotate to face the mouse)

root.onEnterFrame = function (mcplayer) {
// Rotations
angle = Math.atan2((xmouse – ["mcplayer"+.x]), (-1*(ymouse – ["mcplayer"+.y])) )*180/Math.PI;
mcplayer.
rotation = angle;
}

.
.
.

EDIT: How do I add
line breaks ?
EDIT: Thanks jank

 
Flag Post

If it’s inside code blocks (single) line breaks function normally.

Inside block quotes you can use <br/>.

 
Flag Post

Anyone know how I can fix that weird firing glitch i have?

 
Flag Post

Here is the coding I use for my arm:

onClipEvent (enterFrame) {
myRadians = Math.atan2(root._ymouse-this.y, root._xmouse-this.x);
myDegrees = Math.round((myRadians*180/Math.PI));
root.yChange = Math.round(root.ymouse-this.y);
root.xChange = Math.round(root._xmouse-this.x);
this.
rotation = myDegrees+90;

Is there way to modify this for my bullet?

 
Flag Post

Tivaelydoc – Remember me from the chat? Anyway – I’m working on a TD game as well right now (see it at UltimateTowerDefense.com) and all the programming is already practically done, I’m just working on design / art / music / sound. I may be interested in taking another team member into the project to lighten my load. Since your specialty appears to be designing and not programming, I could possibly use you if you are interested (this would require me seeing some examples of what you can do first, of course). It’d be a paid position on a percentage basis. If interested, leave me a “shout” on my kongregate profile.

 
Flag Post

Pretty interesting. I could look into.