Jul 6, 2008

3d Landscape In Swishmax (flash) - some syntax differences but basically same as flash

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

free web hosting

3d Landscape In Swishmax (flash) - some syntax differences but basically same as flash

Tsunami
OK! this tutorial is inspired by a game at addictinggames.com... im not sure how many of you have played it but here it is:
God's Playing Field

Its a cute little game... but when i first played it i though HOW DOES IT DO THAT!!! and by that i mean dot he 3d with the mouse and then today i finally got around to making it...

I used one of the oldest tricks in the book... so lets educate you a lil about flash...

Flash does not support 3D directly, you have to find some way to make your own. You could develop some complicated system for which you could use for any and all of your 3D needs or you could just use this little technique...

the 3 dimensions are X, Y and Z ... the only one's flash knows are X and Y... we have to create a variable for Z and use that to modify the X and Y values so that it "looks" 3d... ok? we do this by creating a scale ratio... or a number by which to multiply them by to make them look 3d


ok start by creating a new movie that is 600 wide and 400 tall... Now create a ground picture... preferably a rectangle with a linear gradient (see example)...

Now make an empty sprite and call it "thing".. inside of thing, draw an oval and then put a shadow under it (optional)...

now click on the scene1 object and add this code:

CODE

onLoad () {
    focalLength = 100;
    width = thing._width;
    height = thing._height;
    Mouse.hide();
}


What this does is it creates a focalLength to help us define our Z... the bigger the number... the smaller the increment of z... the smaller the number the bigger the increment of Z... so if you have 500, 1 Z could be about .5 inches and if you have 5, 1 Z could be about 5 inches... you could play with this number... but for the demonstration i used 100... we also saved our original width and height variables and hid the mouse...


now underneath that add this code...
CODE

onEnterFrame() {
    if (_ymouse <= (400 - thing._height/2)) {
        z = 200 -_ymouse;
    }
    thing._x = _xmouse;
    thing._y = 200 * (focalLength/(focalLength+z));
    thing._width = width * (focalLength/(focalLength + z));
    thing._height = height * (focalLength/(focalLength + z));
}


What it does is it restrains "thing" so that it is on the screen... it calculates Z by making the middle of the screen the origin and make the mouse's y variable control the Z instead of the y. Thing's X is Mouse's X, However, Thing's y you will notice that it changes depending on Z. so if Z is equal to ten, 200 * (100/(100+10)) = 200 * .9; meaning the bigger the number Z the further it is away from you... Then we do the same thing with the width and the height to give the proper scaling and then were done!

You can then add some animations to thing and what not...

(note* Flash users, whenever i say sprite, for you i mean movieclip... so just change the syntax and add the code to the layer that your movie clip is on instead of the scene)

Preview:
Squish : Could be used to make an ant squishing game of sorts >.<

 

 

 


Reply

newt
Thanks for the tut.
I was just looking at this, and you know this would be a great way to to do a menu, or a navagation.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : 3d landscape swishmax flash syntax differences basically flash

  1. Making Interactive Cds With Flash - My second flash tutorial for Beginners (2)
    Im back again with what i think it would be an interesting tutorial for all of you guys who wants to
    take flash out of the web and make really cool interactive CDS. First of all if all of you are
    thinking right now: "this dude is wrong for making interactive cds you have to use macromedia
    Director", well you are right macromedia director it's used to build interactive cds and dvds
    among other things, but you can also make interactive cds with Flash, the thing is: if you want to
    make a simple interactive CD you can totally do it with flash, of course Director brings ...
  2. How To Format Your Flash Disk/ Diskettes - Formatting your flash or diskette (6)
    Now sometime your flash disk or diskette might have corrupt data, don't worrry just format it.
    follow these simple steps: 1. Double click "My Computer" on your desktop. It opens a window with
    all the available disks. 2. Right-click, your "Removable Disk" or "3 1/2 Floppy" 3. Then click
    "Format" it would bring out a window 4. you can either choose "Quick Format" option to make the
    formatting faster. 5. then click the format buttooon. it formats the drive. When it finishes it
    show you the "format complete" dialog, click "ok" and it is done. you have a formatted d...
  3. How To Make 3d Wireframes - A Flash Actionscript tutorial (2)
    Ok to start off this tutorial, i would like to ask you to make a blank flash movie and set the stage
    to have a width of 600 and a height of 400. Now when the movie loads, we need to set some variables
    so lets start off by setting the origin QUOTE origin = new Object(); origin.x = 300; origin.y =
    200; What this does, is it defines the origin to be an object with physical properties such
    as X and Y coordinates and it then sets those coodinates to 300 and 200, which is the center of the
    movie. Now we want to set what is called the 'focalLength'. QUOT...
  4. Load A Another Swf Movie Into Flash Player. - During Execution. (0)
  5. Digital Time - Create a Digital Time in flash. (2)
    Digital Time 1.Create a Text Field and Create set them instance name = “time”. 2.Select the first
    Frame. 3.Press F9 and Copy Code Below and paste it. CODE _root.onEnterFrame =
    function() {     var time:Date = new Date();     hour =
    (time.getHours()<=12) ? time.getHours() :
    (time.getHours()-12);     hour = (hour<10) ? ["0"+hour]
    : hour;     second = time.getSeconds();     second = (second<10) ?
    ["0"+second] : second;     Minutes...
  6. Flashing Your Motherboard's Bios - How to flash a BIOS (10)
    Hello Everyone, Let me start with reintroducing myself into this forum. My name is Michael Odo. A
    Nigerian and one of the previous most active members of this great online community. Well, I know
    that I have been off from here for quite a very long time due to some hard times but, I am back now
    and in full force . Back to the topic of my discussion . BIOS means Basic Input/Output System .
    It is a software embedded into your motherboard and which controls everything on your system.
    Flashing the BIOS is quite a risky affair and you are better adviced not to try t...
  7. Using An Actionscript In Flash For Loops - (0)
    QUOTE When you are dealing with a lot of data, you without a doubt will run into the need to use
    loops. Lets say you would want to attach a movieClip to the stage. If its just a few clips it
    won't form a problem, but what if you wanted to attach a lot more clips? It would be impossible
    to set them up piece by piece. It would take hours of coding the same code over and over again and
    that redundancy is something you could really do without, not even talking about the time you are
    loosing. This is where loops come into action. We have a few different ones to our d...
  8. Loading Movies Technique In Flash - (4)
    What is loading movies technique? Well for example if you are buildin a 7 section website fully
    flash animated, the whole site is flash, one option is to make the 7 sections in the same movie, but
    the result will be a huge movie, that will take a lot of time to load, and probably the user wont
    stay that long to wait. The other option is to make one main movie and 7 other movies one for every
    section and then load does movies dinamically into the main movie, in that case the user its gonna
    load the main movie and then just load the section hes gonna navigate. Now lets get...
  9. Tweening In Flash Mx - Simple tutorial for biginners. (10)
    In this tutorial you will learn how to tween in Flash MX. Motion Tween 1. Create a new
    document in flash. Any size will do. 2. Create any shape or object - just not a Flash UI. 3. On
    the time line right click on the time when you want it to stop moving. right click on a frame and
    click Insert keyframe. 4. Select it, you can use the black picture of a cursor in the toolbox
    (Arrow Tool (v)) 5. With the new Keyframe selected move the object where you want it to move it.
    6. Select the to keyframes with shift. 7. Right click and press Create Motion Tween. 8. Pr...
  10. Flash Movie Loads... - (4)
    Im making a full flash website... For those flash freaks... I used LoadMovieNum to call the a
    movie1. And then movie1 has submovie1. Submovie1 has subs too... (e.g.sub1) How can i load sub1
    retaining the movie1 & submovie1!? and the is there a way? or is it just one loading of movie at
    a time?? =)...
  11. Loadsound Flash Mx - streaming (0)
    I've asked this question in another section but i figure it belongs here. Would like to know if
    it's possible to loop streaming music using loadsound. I've managed to do it by creating a
    movie that loops but i was wondering if there was another way? round.trap17.com...
  12. Flash Tutorials - (7)
    I have been looking for a complete tutorial on how to do flash. I have found a few but they only
    teach you how to do 1 or 2 certain things. I need one that shows excatly step by step how do do
    everything. If anyone out there knows where to find one like that please let me know. Im not
    looking to learn it overnite i am looking for a long term tutorial that i can work at my own pace.
    Tahnks in advance!...
  13. Flash / Multimedia - tutorials (1)
    Building a flash site ---------------------------------------- Kirupa.com - Building a complete
    site hyd-designs.com - PHP Nuke and Flash Animating 3D logo with Swift3D
    ---------------------------------------- http://flashmove.com/fsug/session/s...xpress/demo.htm
    Prototypes ---------------------------------------- http://proto.layer51.com/ A huge list of
    resources links ---------------------------------------- http://www.stranger.per.sg/ FLASH
    TUTORIAL LINKS ---------------------------------------- whatdoiknow.org - Flash Presentatio...



Looking for 3d, landscape, swishmax, flash, syntax, differences, basically, flash

Searching Video's for 3d, landscape, swishmax, flash, syntax, differences, basically, flash
advertisement



3d Landscape In Swishmax (flash) - some syntax differences but basically same as flash



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE