Play free games online!


Go Back   The Game Homepage Forums > Development > Flash Development

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-22-2008, 05:56 PM
NiallTL's Avatar
Gamer
Tin Can
 

Join Date: Mar 2008
Location: Yes.
Posts: 33
NiallTL is on a distinguished road
Send a message via MSN to NiallTL Send a message via Skype™ to NiallTL
Default Easing applied to a custom cursor and random MC generation

I'm needing help for something.

First thing: I have a custom cursor (instance name cursor_mc) and when you move it, like any other cursor, when you stop, it stops. What I'd like to do is applye slight easing to the cursor, like in particle blaster. Any help on that one?

Second: I have a small movieclip (instance name pickup) and I would like to be able to generate random numbers of them that fall down the screen until they dissappear off it, and my character has to pick them up in the air to raise his score.

Any code I could have for that?
__________________
'Lo peoples. I'm NiallTL (Neel Tee Ehl).

Eh, I don't have to put effort into this, do I?
Reply With Quote
  #2  
Old 03-22-2008, 06:41 PM
Gaz's Avatar
Gaz Gaz is offline
Administrator
Power Drill
Better than 63.31% Better than 63.31% Better than 63.31%
 

Join Date: Jun 2007
Location: Ipswich, UK
Posts: 1,022
Gaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to behold
Default

Quote:
Originally Posted by NiallTL View Post
I'm needing help for something.

First thing: I have a custom cursor (instance name cursor_mc) and when you move it, like any other cursor, when you stop, it stops. What I'd like to do is applye slight easing to the cursor, like in particle blaster. Any help on that one?
Well you can move the cursor to your mouse position using:

Code:
mycursor._x = _xmouse;
mycursor._y = _ymouse;
Where "mycursor" is the instance name of your cursor.

For some basic easing try something like:

Code:
xdif = _xmouse - mycursor._x;
ydif = _ymouse - mycursor._y;
mycursor._x += xdif/15;
mycursor._y += ydif/15;
(change the 2s to alter how quickly it eases)


Quote:
Originally Posted by NiallTL View Post
Second: I have a small movieclip (instance name pickup) and I would like to be able to generate random numbers of them that fall down the screen until they dissappear off it, and my character has to pick them up in the air to raise his score.

Any code I could have for that?
First you need to give the movieclip an identifier.
  1. Right click on it in the library and hit "linkage"
  2. Tick "export for actionscript".
  3. Type a name in the identifier box.
For this example I'll call it "poo".

To put them on the stage after a random time use something like this on your main timeline:

On 1st frame:
Code:
startTime = getTimer();
i = 0;
On 2nd frame:
Code:
if(getTimer()-startTime>1000){
    i++;
    attachMovie("poo", "poo"+i, i);
    startTime=getTimer();
}
This will give our falling poos instance names of poo1, poo2 etc.

Note: you could also put the code I mentioned earlier to move the cursor on this 2nd frame too).

On 3rd frame:
Code:
gotoAndPlay(2);
(replace the 2 with what ever frame your 2nd frame actually was)

Then what you need is some code on the poo movie clip to:

on load:
give it a random _x position

on enter frame:
increase it's _y position.
perform a hittest to see if it colided with your cursor.
check if it went off the screen and needs to be deleted.


Hope this helps!
Reply With Quote
  #3  
Old 03-22-2008, 07:20 PM
nàme's Avatar
Gamer
RoboRaptor
Better than 87.70% Better than 87.70% Better than 87.70%
 

Join Date: Aug 2007
Location: edmonton
Posts: 3,332
nàme is on a distinguished roadnàme is on a distinguished road
Default

Quote:
Originally Posted by Gaz View Post
Well you can move the cursor to your mouse position using:

Code:
mycursor._x = _xmouse;
mycursor._y = _ymouse;
Where "mycursor" is the instance name of your cursor.

For some basic easing try something like:

Code:
xdif = _xmouse - mycursor._x;
ydif = _xmouse - mycursor._y;
mycursor._x += xdif/2;
mycursor._y += ydif/2;
(change the 2s to alter how quickly it eases)




First you need to give the movieclip an identifier.
  1. Right click on it in the library and hit "linkage"
  2. Tick "export for actionscript".
  3. Type a name in the identifier box.
For this example I'll call it "poo".

To put them on the stage after a random time use something like this on your main timeline:

On 1st frame:
Code:
startTime = getTimer();
i = 0;
On 2nd frame:
Code:
if(getTimer()-startTime>1000){
    i++;
    attachMovie("poo", "poo"+i, i);
    start=getTimer();
}
This will give our falling poos instance names of poo1, poo2 etc.

Note: you could also put the code I mentioned earlier to move the cursor on this 2nd frame too).

On 3rd frame:
Code:
gotoAndPlay(2);
(replace the 2 with what ever frame your 2nd frame actually was)

Then what you need is some code on the poo movie clip to:

on load:
give it a random _x position

on enter frame:
increase it's _y position.
perform a hittest to see if it colided with your cursor.
check if it went off the screen and needs to be deleted.


Hope this helps!
yea ok... i would hate to have to write that
__________________
(\ (\
( ^_^)
(_(")(")
This is Bunny. Copy and paste bunny into your sig to help him gain world domination...
(\/)
(-_-)
(")(")
This is Bunny's friend. Copy and paste Bunny's friend for back-up...
/\_/\
( .. )
(")(")
This is robot-bunny. He will dominate everything who stands in Bunny's path...
|\_/| _______.
|^^|| ' |
|'') |'')
Bunny's bodyguard carries a gun everywhere he goes...
(\__/)
( O.o)
(> < ) Its a demented bunny...
(\(\ ~~ be a bunny ~~
(='.')~~ make war ~~
o(_")")~~ not luv ~~
Reply With Quote
  #4  
Old 03-22-2008, 09:37 PM
Bigmutha's Avatar
Moderator
Power Drill
Better than 70.21% Better than 70.21% Better than 70.21%
 

Join Date: Aug 2007
Location: Chico, California
Posts: 1,757
Bigmutha is a jewel in the roughBigmutha is a jewel in the rough
Send a message via AIM to Bigmutha Send a message via MSN to Bigmutha
Default

Quote:
Originally Posted by Gaz View Post
Well you can move the cursor to your mouse position using:

Code:
mycursor._x = _xmouse;
mycursor._y = _ymouse;
Where "mycursor" is the instance name of your cursor.

For some basic easing try something like:

Code:
xdif = _xmouse - mycursor._x;
ydif = _xmouse - mycursor._y;
mycursor._x += xdif/2;
mycursor._y += ydif/2;
(change the 2s to alter how quickly it eases)




First you need to give the movieclip an identifier.
  1. Right click on it in the library and hit "linkage"
  2. Tick "export for actionscript".
  3. Type a name in the identifier box.
For this example I'll call it "poo".

To put them on the stage after a random time use something like this on your main timeline:

On 1st frame:
Code:
startTime = getTimer();
i = 0;
On 2nd frame:
Code:
if(getTimer()-startTime>1000){
    i++;
    attachMovie("poo", "poo"+i, i);
    start=getTimer();
}
This will give our falling poos instance names of poo1, poo2 etc.

Note: you could also put the code I mentioned earlier to move the cursor on this 2nd frame too).

On 3rd frame:
Code:
gotoAndPlay(2);
(replace the 2 with what ever frame your 2nd frame actually was)

Then what you need is some code on the poo movie clip to:

on load:
give it a random _x position

on enter frame:
increase it's _y position.
perform a hittest to see if it colided with your cursor.
check if it went off the screen and needs to be deleted.


Hope this helps!
Wow, I thought you only knew a little AS.

Quote:
Originally Posted by Gaz View Post
For this example I'll call it "poo".
I actually laughed when I saw this.
__________________

Last edited by Bigmutha; 03-22-2008 at 09:37 PM. Reason: Automerged Doublepost
Reply With Quote
  #5  
Old 03-24-2008, 04:11 PM
NiallTL's Avatar
Gamer
Tin Can
 

Join Date: Mar 2008
Location: Yes.
Posts: 33
NiallTL is on a distinguished road
Send a message via MSN to NiallTL Send a message via Skype™ to NiallTL
Default

Yeah.... slight problem Gaz.
None of that worked. At all.
I am not best pleased

I'm currently PM'ing you the file to see if you can help a tad.
__________________
'Lo peoples. I'm NiallTL (Neel Tee Ehl).

Eh, I don't have to put effort into this, do I?
Reply With Quote
  #6  
Old 03-24-2008, 08:06 PM
Gaz's Avatar
Gaz Gaz is offline
Administrator
Power Drill
Better than 63.31% Better than 63.31% Better than 63.31%
 

Join Date: Jun 2007
Location: Ipswich, UK
Posts: 1,022
Gaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to behold
Default

Quote:
Originally Posted by NiallTL View Post
Yeah.... slight problem Gaz.
None of that worked. At all.
I am not best pleased

I'm currently PM'ing you the file to see if you can help a tad.
Oops! Well I wrote it off the top of my head, hang on I'll give it a try.
Reply With Quote
  #7  
Old 03-24-2008, 08:48 PM
Gaz's Avatar
Gaz Gaz is offline
Administrator
Power Drill
Better than 63.31% Better than 63.31% Better than 63.31%
 

Join Date: Jun 2007
Location: Ipswich, UK
Posts: 1,022
Gaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to beholdGaz is a splendid one to behold
Default

Ah yeah I found a couple of typos (fixed now).

You can see the code in action here:

Watch Out For Poo! - The Game Homepage

I also attached the .fla to this post.

- If that doesn't make you best pleased I don't know what will
Attached Files
File Type: fla watch-out-for-poo.fla (128.0 KB, 3 views)
Reply With Quote
  #8  
Old 03-24-2008, 10:15 PM
nàme's Avatar
Gamer
RoboRaptor
Better than 87.70% Better than 87.70% Better than 87.70%
 

Join Date: Aug 2007
Location: edmonton
Posts: 3,332
nàme is on a distinguished roadnàme is on a distinguished road
Default

Quote:
Originally Posted by Gaz View Post
Ah yeah I found a couple of typos (fixed now).

You can see the code in action here:

Watch Out For Poo! - The Game Homepage

I also attached the .fla to this post.

- If that doesn't make you best pleased I don't know what will
lol. the goal is to get covered completely... i won
__________________
(\ (\
( ^_^)
(_(")(")
This is Bunny. Copy and paste bunny into your sig to help him gain world domination...
(\/)
(-_-)
(")(")
This is Bunny's friend. Copy and paste Bunny's friend for back-up...
/\_/\
( .. )
(")(")
This is robot-bunny. He will dominate everything who stands in Bunny's path...
|\_/| _______.
|^^|| ' |
|'') |'')
Bunny's bodyguard carries a gun everywhere he goes...
(\__/)
( O.o)
(> < ) Its a demented bunny...
(\(\ ~~ be a bunny ~~
(='.')~~ make war ~~
o(_")")~~ not luv ~~
Reply With Quote
  #9  
Old 03-25-2008, 02:04 AM
cheese toast's Avatar
Gamer
Air Conditioner
Better than 78.21% Better than 78.21% Better than 78.21%
 
Join Date: Nov 2007
Location: The snake run
Posts: 2,622
cheese toast is a jewel in the roughcheese toast is a jewel in the roughcheese toast is a jewel in the roughcheese toast is a jewel in the roughcheese toast is a jewel in the rough
Default

the name is very deceptive! you're meant to 'Get hit by poo!' lmfao..
__________________
"Looking at the room
I can tell that you
Are the most beautiful girl
In the

Room

And when you're on the street
Depending on the street
I bet you are definitely

In the top three"

Reply With Quote
  #10  
Old 03-25-2008, 11:32 AM
NiallTL's Avatar
Gamer
Tin Can
 

Join Date: Mar 2008
Location: Yes.
Posts: 33
NiallTL is on a distinguished road
Send a message via MSN to NiallTL Send a message via Skype™ to NiallTL
Default

Thanks so much Gaz, I'll try it out when I get onto my own computer I'll credit you for helping in my game

Who knows, if I extend my game a bit I might get a frontpage on TGH when I submit!

Ah, hopes and dreams

I'll report back when I've tried all the stuff out.
__________________
'Lo peoples. I'm NiallTL (Neel Tee Ehl).

Eh, I don't have to put effort into this, do I?
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:55 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2007, Crawlability, Inc.

Ad Management by RedTyger