A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [Game Dev] Land Raider

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    [Game Dev] Land Raider

    This is a thread for my tank game called land raider.... It would be nice if yhe poeple here at FK would be able to help me in any delemers and point me in the right direction.

    My game is a side scroller and my tank has a rotatable turret, but i cant seem to get it to stop after rotationg 180 degree's here is my code can some one tell me what i am doing wrong or a place that has somthing like this.

    Code:
    onClipEvent (load) {
    	weopon.gotoAndStop(1);
    	gotoAndStop(1);
    	acceleration = 0;
    	zero = 0;
    	gravity = 2;
    	speed = 10;
    	rotation = 5;
    	maxrotation = 180;
    }
    onClipEvent (enterFrame) {
    	if (Key.isDown(Key.UP)) {
    		weopon._rotation = rotation++;
    	} else {
    		if (weopon._rotation>maxrotation) {
    			weopon._rotation = rotation--;
    		}
    	}
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  2. #2
    Official Shoe Shiner thehumanchimp's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    953
    something like this?
    code:

    if ((Key.isDown(Key.UP)) && ((weopon._rotation<maxrotation))) {
    weopon._rotation = rotation++;
    } else if ((Key.isDown(Key.DOWN)) && (weopon._rotation>0)) {
    weopon._rotation = rotation--;
    }


    (weapon is spelt weapon, not weopon )
    Message on a gravestone: I finished before you in the human race.

    Using: Flash MX

  3. #3
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    kewl thanks,

    i changed my code a little because it wasnt running smooth. here is the new one and it works like a charm so if any one needs it in the future here it is.
    Code:
    onClipEvent (enterFrame) {
    	if ((Key.isDown(Key.UP)) && ((weopon._rotation<180))) {
    		weopon._rotation += 5;
    	} else if ((Key.isDown(Key.DOWN)) && (weopon._rotation>0)) {
    		weopon._rotation -= 5;
    	}
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  4. #4
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    I need a tutorial on how to make my tank rotate with the ground Eg: if the ground is at a 45 degree angle i want my tank to be at 45degree's to....

    dose any one know of a good tutorial for this??? or any ideas on how it could be done.
    I saw this kewl game on some site of a monster truck and u had to get threw the level without tipping over....the ground was all hilly and there was some kewl gravity codes in place. it was realy kewl.
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  5. #5
    Official Shoe Shiner thehumanchimp's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    953
    erm, tank._rotation=ground._rotation ?
    Message on a gravestone: I finished before you in the human race.

    Using: Flash MX

  6. #6
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    i dont understand....

    think of it like this.... there is a hill it gose up and then down.... when my tank begins to go up my tank rotates with the angle of the ground.

    I belive there is going to be some fair crucial maths needed... if it were simpler i would just ask for peepz help....
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  7. #7
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    here is a game called funky truck, can any one tell me how i would make my tank rotate to the angle of the ground...

    http://www.teagames.com/games/funkytruck/play.php

    I would realy apreciate if you new of a tutorial or something
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  8. #8
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    BlinkOk has provided very nice example in this thread:
    http://www.flashkit.com/board/showthread.php?t=646378

  9. #9
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    kewl... i checked out your tutorial on vectort as well... its all way to confusing and i cant thing of a way to do what i want simpler... If you know of a way tell me.... i dont care if its a bit dodgy im only new and only trying to learn...

    but any ways, my game will just have to go wihtout
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center