Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-18-2003, 05:59 PM   #1
Registered User
Join Date: Jul 2003
Posts: 5
Default Help with frogger game

Help ! Please look at the attached code. I want the player mc to move at the same rate as the trans mc's when hitTest is performed. and also be able to move to either end of the trans mc's (walk along length). As you can see it keeps flipping to the middle.
Hope this makes sense! many thanks!
fatbloke is offline   Reply With Quote
Old 07-18-2003, 06:03 PM   #2
Registered User
Join Date: Jul 2003
Posts: 5
Default file

Attached Files
File Type: zip frogger.zip (2.8 KB, 345 views)
fatbloke is offline   Reply With Quote
Old 07-18-2003, 11:27 PM   #3
Registered User
Join Date: Aug 2001
Location: Malibu
Posts: 56
Send a message via AIM to ebmGameGuy

I didn't actually look at your code, but I did write some of my own. You can modify this to fit your game. As you can see I only had one log in my test file but you should be able to figure out how to get all of the logs to call the same function.

ActionScript Code:
// Keys Key.addListener(frog); frog.onKeyDown = function() {     if (this.keyed == 0) {         this.keyed = 1;         currentKey = Key.getCode();         this.getKey(currentKey);     } }; frog.onKeyUp = function() {     this.keyed = 0}; frog.getKey = function(keys) {     if (keys == 37) {         frog.move(1);     }else if (keys == 38) {         frog.move(3);     }else if (keys == 39) {         frog.move(2);     }else if (keys == 40) {         frog.move(4);     } }; frog.move = function(dir) {     switch(dir) {         case 1:             // Left             this._x -= 25;             break;         case 2:             // right             this._x += 25;             break;         case 3:             // up             this._y -= 50;             break;         case 4:             // down             this._y += 50;             break;     } }; frog.changeX = function(x) {     // frogs position changed by object     // it is sitting on     this._x += x; }; log.speed = 5; log.onEnterFrame = function() {     // move log     this._x += this.speed;     // look for frog     if (this.hitTest(frog)) {         // change frogs x position         frog.changeX(this.speed);     } };

all of this code is on the main timeline
ebmGameGuy is offline   Reply With Quote
Old 07-19-2003, 02:57 AM   #4
Registered User
Join Date: Jul 2003
Posts: 5

I've just pasted the code into a new movie and it works cool. Thats just what I needed many thanks ebmGameGuy!
fatbloke is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump

All times are GMT. The time now is 06:46 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.