RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (Full Version)

All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy



Message


Sephiroth12 -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/16/2008 8:04:13)

I think that that code is getting the length and width of the area that the ball, I'm guessing, can go. And the maxY is the farthest area you could go, same for maxX, and so on. And if it hits that area, it would go back. It's similar to the code I have for a walkaround engine, but not quite... :P and thanks BiG




Taerzik -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/16/2008 9:41:00)

  if (_root.walls.hitTest(getBounds(_root).xMax, _y, true)) {
            _x -= myBounce;
        }
        if (_root.walls.hitTest(getBounds(_root).xMin, _y, true)) {
            _x += myBounce;
        }
        if (_root.walls.hitTest(_x, getBounds(_root).yMax, true)) {
            _y -= myBounce;
        }
        if (_root.walls.hitTest(_x, getBounds(_root).yMin, true)) {
            _y += myBounce;
        }


Ok Nicky, lemme see here:
'_root.walls' are, obviously , your wall mc(s), which are 'hitTest'ing with your character.
'getBounds' is basing the data it returns (four coordinates: xMin, xMax, yMin, yMax) off of the '_root'. The reason that this is important is if you had nested clips the returned values could be based off a parent rather than _root and would be different.

So in near plain English, the first two/three lines say, "If the point at this object's 'xMax' (figured from '_root') and '_y' (so xMax,_y is the x,y of the point being checked on) bumps into the wall, this object's x position is reset to it's current x minus the value of myBounce."


That clear? Seph. almost had it right.

If you are confused think of it this way:
xMin = actual _x
yMin = actual _y
xMax = actual _x + width
yMax = actual _y + height

That may be dependant on the content of the mc being at 0,0 in the mc. I don't remember.




jiggibidy -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/16/2008 12:41:12)

I'm a complete amateur at ActionScript, so this may be completely wrong, but this is my attempt at a basic XP/Level engine.

health = 10
ehealth = 10
xp = 0
level = 1
if (_root.health<0){_root.health = _root.health + 10;}
if (_root.ehealth<0){_root.xp = _root.xp + 1;}
if (_root.ehealth<0){_root.ehealth = _root.ehealth + 10;}
if (_root.xp>10){_root.level = _root.level + 1;}
if (_root.xp>50){_root.level = _root.level + 1;}
if (_root.xp>100){_root.level = _root.level + 1;}

The battle system is sound, the numbers go down easily enough.

What isn't working:
When your health is less than 0, it is supposed to increase by ten.
When the enemy's health is less than 0, it is supposed to increase by ten, and xp is supposed to increase by 1.
When xp is more than 10, level increases by one, then when xp is more than 50, level increases by one again, and so on, until I decide that enough is enough and say that you need 999,999,999,999,999 xp to get to the next level.

Help would be appreciated.

~Peace Out,

~Jiggi.




biG frend -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/16/2008 13:09:18)

jiggibidy You need to put that code

if (_root.health<0){_root.health = _root.health + 10;}
if (_root.ehealth<0){_root.xp = _root.xp + 1;}
if (_root.ehealth<0){_root.ehealth = _root.ehealth + 10;}
if (_root.xp>10){_root.level = _root.level + 1;}
if (_root.xp>50){_root.level = _root.level + 1;}
if (_root.xp>100){_root.level = _root.level + 1;}


On the second frame of the battle system your working on.




jiggibidy -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/16/2008 13:45:52)

Another problem, I would like a system where when I level up, my xp still increases, but my level increases at regular intervals.
But, when my xp gets to 11, my level increases like normal, but if I attack again, my level goes up again.
Here is my code:

if (_root.xp>10){_root.level = _root.level + 1;}
if (_root.xp>50){_root.level = _root.level + 1;}
if (_root.xp>100){_root.level = _root.level + 1;}

I think the problem is:

It says if xp is higher than 10, increase level by 1, but because every turn, my xp is above 10, it increases level by 1 every turn.
So I need some way of making a line of code become void whenever it is achieved.

Thanks in advance.

~Peace Out,

~Jiggi.




Sephiroth12 -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/16/2008 22:10:51)

Here's the code I have for the battles in an RPG I'm making(this is on the 2nd frame of my battle :P) I have a start button on that frame because the battle's in a movie-clip and if it's not for some reason Flash will go ot the 2nd frame and instead of playing it will exit out of the battle mc :P But anyway, here's what I have:

phealth = 100;
bhealth = 100;
if(xp!=0 & xp<3){
	xp = 0;
}
if(xp<=10 & xp<20){
	level = 1;
	mp = 75;
}else{
	if(xp<=20 & xp<30){
		level = 2;
		phealth = 115;
		mp = 100;
	}else{
		if(xp<=30 & xp<40){
			level = 3;
			phealth = 130;
			mp = 115;
		}else{
			if(xp<=40 & xp<50){
				level = 4;
				phealth = 150;
				mp = 130;
			}else{
				if(xp<=50){
					level = 5;
					phealth = 175;
					mp = 150;
				}else{
					if(xp<20){
					level = 1;
					}
				}
			}
		}
	}
}


phealth stands for player_health :P

This may or may not help, but I'm guessing it should be able to help you :P

Oh, and at the end of every battle, when it goes to the winning frame, here's the code ofr that frame:

stop();
xp = xp+5;


here's the code for the losing frame:

stop();
xp = xp+(3);


So, that should help a bit for reference as to "how" to do it :P

Edit:

And yes, I know, I didn't declare the variables as _root's, but for some reason at least with my computer, if I do, then the code won't work :P Or at least for the battle stuff when damage is being taken off.




jiggibidy -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/17/2008 13:16:15)

Thanks, I got it all sorted now.
The code worked even though the variables weren't defined as _root.'s.
Thanks a bunch, I owe you one.

~Peace Out,

~Jiggi.




Nicky -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/19/2008 8:17:06)

Taerzik & Sephiroth: Thanks! That pretty much made it get through for me ^_^.

I read it a few days ago but, the person I am, forgot to leave a thanks comment :P.




flsg -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/19/2008 17:08:19)

I almost cried @ nicky's post lol
no one even WANT to know what their code does as long as it does the job =/

BTW the code wont work well, the wall MC(suppose you want to do something like the maze in AQ's drake thing...forgot his name...)is consdered as a SINGLE rectangle when you do the hittest, so as long as your movable char is inside the mc, it will always return true(hitted)




Nicky -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/19/2008 21:34:49)

XD. Well, I'm looking into the future and I'm pretty sure I'll need the code for a class next year and it's probably best if I know what it does :P.

And ah, okays. I'll do some experiments.

I wondered why my character could walk through some of the walls :|.




EragonZZZZ -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/19/2008 23:47:27)

Someone needs to give me a coding challenge.

Something that might or might not be useful, but is ridiculous yet feasible, and fun :]

School's boring, so I don't have time for serious projects, but I need inspiration so I can keep from getting rusty.




flsg -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/21/2008 10:24:32)

^ eragon pm meh yo MSNNNNNNNNNN

I wanna make a flash-based forum lol(guess what, I'm bored too lol)




TreadLight -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/24/2008 16:58:24)

I have a problem with this code... I'm kind of confused, even if it may be some basic stuff:

Stage.scaleMode = "noScale";

var step:Number = 8;
var flipped = -guy._xscale;

onEnterFrame = function() {
	if (Key.isDown(Key.RIGHT)) {
		guy._xscale = -flipped;
		guy._x += step;
		
		if(guy._currentframe < 6) {
			guy.gotoAndPlay(6);
		}
		if(guy._currentframe < 31) {
			guy.nextFrame();
		} else {
			guy.gotoAndPlay(6);
		}
	} else if (Key.isDown(Key.LEFT)) {		
		guy._xscale = flipped;
		
		guy._x -= step;
		if(guy._currentframe < 6) {
			guy.gotoAndPlay(6);
		}
		if(guy._currentframe < 31) {
			guy.nextFrame();
		} else {
			guy.gotoAndPlay(6);
		}
	} else if (Key.isDown(Key.UP)) {		
		
		guy._x -= step;
		if(guy._currentframe < 32) {
			guy.gotoAndPlay(32);
		}
		if(guy._currentframe < 59) {
			guy.nextFrame(59);
		} else {
			guy.gotoAndPlay(32);
		}
	}
}


The problem is that this happens: http://www.swfcabin.com/open/1222285798

Can you show me how to code these things?

  1. Have the character do the entire animation without stopping when you release the arrow key.
  2. Have the character not go to the side when jumping, but only go to one of the sides if both the left or right arrow key is held down with the up arrow key.

Thank you all!




EragonZZZZ -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/24/2008 18:09:23)

I'd love to help but I'm not certain what you're trying to accomplish with this code x.x

If you're trying to make a game you're going to be severely hampered if you manually step through all the frames, as you're doing now.
I'm not quite certain why you did that...Flash plays them automatically. Just use the if(currentframe > blah) statement.

Also, look into putting code on your character MCs to ensure that they play an animation (say a jumping animation) once and then return to the idle frame when the "jumpstart" frame is hit, etc.




//.Shadow.\\ -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (9/28/2008 13:11:58)

Added tutorial!
http://forums2.battleon.com/f/tm.asp?m=14826425




Taerzik -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/7/2008 13:41:19)

Got a problem.

I need to load a clip (A) into another clip (B).
Problem is, B consists of several frames and after loading A into B, A disappears after the first frame of B.
I tried putting the instance of A into a parent of B, which seems to solve the problem, but then I can't get a reference to A to set its x and y.




EragonZZZZ -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/7/2008 17:25:10)

I'm sure this isn't the best way to do it, but it's what I immediately thought of:

Assign a listener event to B.onEnterFrame and have that event call an attaching function.

Other than that, no idea. Have to think about it.

______________

In other news, I'm typing this from the new family computer ^___^

HP w1907 with a Quad-core processor and 5 gigs of RAM.

And it was under 1000 bucks at Best Buy, new. Gotta love their sales.




Taerzik -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/9/2008 5:19:04)

Easy solution - I forgot that the mc instance on frame 1 was named but not the others so, obviously, when the parent clip went beyond frame 1, the newly attached mc disappeared because the mc it was attached to lost its name.
Oh well, thanks EZ.

New PC eh? Nice!




Taerzik -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/17/2008 17:53:52)

So... anyone familiar with Shared Objects? I'd like to let my users save their account name and password to the disk.
Unfortunately, the flush doesn't seem to be working... The file is set for local only, and I'm running the tests with a local file.

Any ideas, common mistakes, etc?

Thanks




biG frend -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/17/2008 18:27:52)

Just use something like this.

Put this on the button or checkbox or w/e that saves it.

on (release)
{
_root.pos = SharedObject.getLocal("file_name");
_root.pos.data.username = _root.username;
_root.pos.data.password = _root.password;


}

Just replace username and password with the var name of the text boxes. And

Then put that on the frame.

_root.pos = SharedObject.getLocal("File_name");

_root.username = _root.pos.data.username;
_root.password = _root.pos.data.password;




Taerzik -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/18/2008 2:43:01)

That's what I thought, and did... I think. Ok then, probably a small technicality in my script is messing it up. I'll check it over.

...

Got it working now.

Thanks biG.




Taerzik -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/20/2008 3:40:17)

Anyone have any good tips or suggestions on code organization, cleanup, condensing or protection?

I just went and transfered a pile of beta-level code to an external script (turned out to be pretty easy) which should help immensely but I'll take any other suggestions.


Thanks yall.




darksideofthefarm -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/20/2008 13:49:25)

ok I have a problem, my friend wants to make an RPG (turn-based) with me but he only cna make art which puts scripting on me. Im a huge newbie at scripting. (im using Action script 2.0)

So hers some problems
1. my exp bar goes down instead of going up when I get exp
2. account creation, what biG said makes a little sense. Like how do I allow people to make account and have so they are able to log on
3. Saving peoples chars in their account
4. quest rewards and item drops

I know, some of this stuff is probably simple but I have no clue '-_-

Anyone have any help lol. All help please thanks!




SuperGuy 9000 -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/20/2008 14:23:50)

Can somene give me a direct link to downloading Flash please? I can't seem to find it all on the link in the first post...




jiggibidy -> RE: Flash Q&A Thread 5 - Flash Has Shares In Your Soul (10/27/2008 9:14:57)

Hmm... this may see a bit much to ask, but can you look at this .fla for me?
It originally consisted of 4 frames, 2 being stat increases and the other 2 being a battle.
I decided to make a title screen for it, which went without a hitch, but now whenever I test the game ot see whether or not it works, the health variables all say NAN.
Here is the link, it's in a Flash 8 format, so almost anyone with Flash can help me out.
Oh yeah, and it's in AS2.
When/if you're done, could you please upload it to a hosting site and PM me the link, also, could you please tell me what was wrong?
Thanks in advance.

~Peace Out,

~Jiggi.




Page: <<   < prev  10 11 [12] 13 14   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition
0.171875