Home  | Login  | Register  | Help  | Play 

RE: Flash Q&A thread 2 ** checked everyday

 
Logged in as: Guest
  Printable Version
All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy >> RE: Flash Q&A thread 2 ** checked everyday
Page 8 of 24«<678910>»
Forum Login
Message << Older Topic   Newer Topic >>
3/28/2006 11:07:35   
Darklord517
Member

How would you make it so that if a guy hits a coin for example the amount of money which is a dynamic text box with a variable of gold goes from 50 to 100?

_____________________________

quote:

ORIGINAL: Dark Google

You need sarcasm lessons.
AQ DF  Post #: 176
3/28/2006 11:47:24   
somebody621
Member

//if the movie clip with the instance name char on the main timeline collides with the movie clip with instance name coin on the main timeline
if(_root.char.hitTest(_root.coin, true){
//add 50 to the variable money, located on the main timeline.
_root.money + = 50;
//delete the money move clip.
removeMovieClip(_root.money);
//end the code
}
a simple way using hitTests. Seriously. Try to figure out your own code these days. People just take the code for granted.
Post #: 177
3/28/2006 12:27:21   
Darklord517
Member

Thanks somebody i was stuck on that code for a long while i tried about 20 different codes i made myself but thanx anyway, BTW i do use my own AS its just tat when i puzzle over something for too long i get really leary.
AQ DF  Post #: 178
3/28/2006 16:16:47   
steelsoldier
Member

Thanks to this tutorial i can now do flash movies!!!!
http://img393.imageshack.us/my.php?image=untitled46me.swf
2 days try and i did this stupid flash lol

< Message edited by steelsoldier -- 3/28/2006 16:17:34 >
AQ  Post #: 179
3/28/2006 16:44:50   
flsg
Member

steelsoldier: it's good, but you could perhaps try some motion in Flash
Somebody: thanks a lot!!!
AQ  Post #: 180
3/28/2006 18:14:03   
mathus the seconth
Member

how do u loop sounds?

_____________________________

AQ  Post #: 181
3/28/2006 20:35:42   
flsg
Member

mathus the seconth:
//declare an new Sound Object
var mySound=new Sound()
mySound.attachSound(libraryLinkageOfTheSound)
mySound.start(howManyTimes,0)

_____________________________

My flash gallery
my game thread

flsg, proud old member of AQ(still playing :O)
AQ  Post #: 182
3/29/2006 14:34:10   
somebody621
Member

Made a little code to test the FPS of an movie. My movies keep lagging.
Here goes.
Type this code on the first frame of an MC's timeline. It's heavily commented, so beware!
The comments are there for a reason, and figure out what the code is doing before you copy and paste(I hate copy and pasters).

//set the FPS.  Movie only runs through this code once.  It's just to set it
var FPS=1;
//set a variable i.  This will be used to see how many times the getFPS function has run
var i=1;
//the movies framespeed that you set in the properties panel.  You can change this around.  All it's there for is to test the lag of the movie.
var j=24;
//on every frame
onEnterFrame=function(){
	//make a variable FPS increase by one.  If you have Flash 5 or lower, put FPS+=1.
	FPS++
	//see how how many frames have passed.  Delete this code if you want.
	trace(FPS);
}
//define a function that runs on a set interval, defined at the end.  It requires no arguments or parameters
getFPS = setInterval (function(){
	//the actual framespeed is the amount of frames passed divided by how many times this code has run, since it runs every second.  FPS=frames per second.
	actualFPS=FPS/i;
	//test the lag of the movie.  All this is is subracting the framespeed the movie is going from the framespeed the movie should be going.
	actualLag=j-actualFPS;
	//the framespeed rounded to the nearest whole number
	approxFPS=Math.round(actualFPS);
	approxLag=Math.round(actualLag);
	/*make variable i increase.  i represents the amount of times this code has run.  You could also
	delete the actualFPS = FPS/i line, and put FPS=1 right here, but that would be less accurate.  Also, for 
	flash versions 5 and lower put i+=1.*/
	i++
//run this code every second.
},1000);
//code made by somebody621
	

Make two dynamic textboxes, one with the variable name approxLag, and the other with the variable name approxFPS.
You can change these to other variables in the code, but I don't like huge irrational numbers. Label them with static textboxes next to them.

Ideas:You could turn this into a componant for other movies. Then you wouldn't have to dig inside the movie clip to set the variable j, just type into the component.
Post #: 183
3/29/2006 16:36:00   
flsg
Member

cool code! Never though we could use setInterval on differents lines lol
just a little comment: since you're not gonna to use getFPS, write simply: setInterval(......)
well, if you need to clear it later then you'll need it lol
AQ  Post #: 184
3/30/2006 9:24:59   
somebody621
Member

You can still us clearInterval for my code. setInterval also requires the function name. setInterval(function name, time, and parameters)
Post #: 185
3/30/2006 16:59:25   
flsg
Member

what I'm saying is that it can be a temp function with only one line, like this:
setInterval(function (){trace("hi"), 1000}
but I didn't know we could use:
setInterval(function(){
//code here...
}
, 1000)
AQ  Post #: 186
3/30/2006 18:30:44   
somebody621
Member

Made a little light generator. The inspiration is from a project on Ultrashock test actionscript projects. Basicly, my version defines a random value for each particles y position and uses the Pythagorean theorem to find the x position so that it snaps to a circle defined within my actionscript, then divides that y by two. Every frame, the points of light go up and their alpha decreases. The depth of the points is defined by the y position when the points are first made. There still are a couple of depth sorting problems, but here it is!

I've heard that the random operator is deprecated. What do we use instead? Also, what does int do?

EDIT: Depth Problems Fixed!

< Message edited by somebody621 -- 3/30/2006 21:33:43 >
Post #: 187
3/31/2006 15:22:52   
Crimson dragon
Member

lol i need help again.
ive been doin alright up to now, im alright at action script now (thanks kirupa and flsg!)
....ok ive made a shop in a game, how would i make it so wen i press the "buy" button i lose the amount of gold it is.
Ive tried many codes for this plz help.
thanks =)
AQ  Post #: 188
3/31/2006 15:28:37   
Darklord517
Member

well that depends on the amount of gold you already have im not sure how to do it in AS but i now what you have to do.

Somebody, flsg, Zoltan, LBB please right this in AS.

First you have to find out how much gold you already have, this should be a variable. Then when you click buy it should be
on (release){
_root.gold = "" - 50;
}

The words in bold should be changed to what you have.

Is this correct flash gurus?

_____________________________

quote:

ORIGINAL: Dark Google

You need sarcasm lessons.
AQ DF  Post #: 189
3/31/2006 15:33:22   
Crimson dragon
Member

thanks for telling me that but i already hav my gold var etc.
all i need 2 know is how 2 lose gold wen i buy it lol
EDIT-actually thank you very much darklord that helped a lot!
EDITEDIT-Darklord thanks a lot a lot! it works!!!!!!!!! Whooooo!
EDITEDITEDIT-ok so it isnt working that well. i went with 70 gold and 60 was took off and that is fine. but i go back with 200 gold and wen i press buy it takes my gold 2 70 and then takes 60 off leaveing me with 10 again. so can anybody help in making the amount of gold in the "" vary 2 how much u actually have (if all that makes sence)

< Message edited by Crimson dragon -- 3/31/2006 16:24:10 >
AQ  Post #: 190
3/31/2006 16:34:24   
flsg
Member

somebody621L int() is like Math.round(), but doesn't round the number
ex:
int(3.1)//return 3
Math.round(3.1)//return 3
int(3.5)//return 3
Math.round(3.5)//return 4

darklord517: I don't know, but I have my own better way:
//code on the frame...
//_global.gold repleace _root.gold since you can access it easily from anywhere
_global.gold:Number=0
//code on the button
on(Release){
  _global.gold-=50
  //_root.tf is a dynamic TextField
  _root.tf.text=_global.gold
}


< Message edited by flsg -- 3/31/2006 17:01:12 >
AQ  Post #: 191
3/31/2006 18:59:13   
somebody621
Member

I have my even better way. lol
//define the amount of gold you have
user.gold = 500;
//define a function
//gold is the money you should lose in this function
function loseGold(gold){
//if your gold is higher than the gold needed
if(gold < user.gold){
//user's gold is decreased by gold. Thanks flsg for pointing out my error.
user.gold -= gold;
}
}
//when the mouse button is released over your button
mybutton.onRelease = function(){
//lose 50 gold
loseGold(50);
}
You must have declared the gold value twice. Get rid of one.
nvm, I see what you have wrong. You wouldn't use _root.gold = ""-50, but declare gold earlier and use _root.gold -= 50;

< Message edited by somebody621 -- 3/31/2006 23:19:43 >
Post #: 192
3/31/2006 21:50:53   
flsg
Member

lol, you even build a function for this
anyway, you forgot the "=" in user.gold - gold
edit: does anyone know a good site about Java+Flash?

< Message edited by flsg -- 4/1/2006 16:22:07 >
AQ  Post #: 193
4/1/2006 22:41:02   
lil boi blue
Member

check this out, i've decided that since you guys have been here for awhile, we will call ourselves....the flazh possay
Lil boi blue
flsg
Zoltan
somebody621
AQ DF  Post #: 194
4/2/2006 0:30:02   
flsg
Member

lol...Flash possay...what does possay means? Sorry I'm not very good at English

darklord517: I forgot to say that your code doesn't work because of _root.gold-=""-gold
you can put a trace() statement after _root.gold=""-gold, like this:
trace(_root.gold)

you'll see that in the output screen(when you play your movie in Flash), you can see the Number NaN(yes, NaN is a number in Flash)
let me explain:
"" is a string, gold is a number
when we do the operation ""-gold, Flash first convert the string into a number, than it calculate the return value
"" converted into number is NaN(legal numeric value, Not a Number)
NaN-gold(a number)=NaN
understand now?
P.S. "1" convert into number is 1, "2" is 2, "3.123412" is 3.123412...


does someone know a good site to host a webpage?(ASP+JSP+Access)

< Message edited by flsg -- 4/2/2006 0:32:11 >
AQ  Post #: 195
4/2/2006 0:39:50   
lil boi blue
Member

http://dictionary.reference.com/search?r=2&q=posse its really spelled posse but i just did it possay for purnunciation perposes

(paw-say) its a group of people called to help a police chief but in slang it can refer to a group of people called together or something like that

www.google.com !! just search it free webpage hoster, i know bravenet, freewebs, and 712 or something like that

flsg.bravenet.org thats how they do it
AQ DF  Post #: 196
4/2/2006 1:06:39   
Darklord517
Member

Oh thnks now my own thing will work lol.
AQ DF  Post #: 197
4/2/2006 1:58:16   
mathus the seconth
Member

can anyone help me with the game im making? all the scripts ppl give me dont work. its a shooting game, like the one zoltan made, i have a bg, a gun with a crosshair, an enemy, and a bullet. the scripts on the gun are:

//gun replaces cursor.
onClipEvent (load) {
	
startDrag("", true);
	Mouse.hide();
}
//I made this section myself:
//when you press, the bullethole x & y = the gun x & y.
onClipEvent(mouseDown) {
	_root.bullethole._y = _root.gun._y;
	_root.bullethole._x = _root.gun._x;
}


thats just about it.
now i need u to teach me how to make scorecount, reload, and hittest between the bullet and the enemy (if u can of course) ill upload a file of what i have later.

EDIT: here is what i have so far.

timebomb

(turn up the volume music by me, thanks to http://www.ctcmix.com, i found this site on a cereal box lol long time ago.)

u should try this hoster: http://www.badongo.com/, it can take 1 gig files!!!!, thats AMAZING.

EDIT EDIT: I fixed the script,
Before --->
on (press) {


After --->
onClipEvent(mouseDown) {


it makes it go much smoother.

< Message edited by mathus the seconth -- 4/2/2006 4:06:06 >
AQ  Post #: 198
4/2/2006 3:05:57   
lil boi blue
Member

as many know im a graphics guy but here is a site thats pretty good, if you go to tutorials, it has a game section, VERY unorganized though www.flashkit.com and the search thing doesn't work too well
AQ DF  Post #: 199
4/2/2006 13:08:17   
mathus the seconth
Member

lbb, can u so graphics for my game? whatever u think looks bad in my game (which there is alot) can you draw it better? in the end of the game ill give u credit for graphic design in the credits.
AQ  Post #: 200
Page:   <<   < prev  6 7 [8] 9 10   next >   >>
All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy >> RE: Flash Q&A thread 2 ** checked everyday
Page 8 of 24«<678910>»
Jump to:






Icon Legend
New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts




Forum Content Copyright © 2018 Artix Entertainment, LLC.

"AdventureQuest", "DragonFable", "MechQuest", "EpicDuel", "BattleOn.com", "AdventureQuest Worlds", "Artix Entertainment"
and all game character names are either trademarks or registered trademarks of Artix Entertainment, LLC. All rights are reserved.
PRIVACY POLICY


Forum Software © ASPPlayground.NET Advanced Edition