Forums → Programming Forum → A Games Special Features Programming Code (AS3)
- 5 Replies
I really wondered How I can do it or That using AS3. Now I learnt at least some of it. I tried to create a game like "Learn to Fly" I at least created 30 - 40% of game. But I encountered with some problems. I did not understand the Special Speed Meters, fuel system, ramp height and length effect, And if altitude. These are the major problems. Help me
Almost everything in code for a game is either an if, or a function.
Think, if MovieClip.y returns as a number, we should be able to use it as such, right?
So to figure out your altitude, you might do...
altitude = player.y;
altitude = (player.y); //then you might do *2 or /2 if the number is too big or too small.
And for fuel you might do...
var fuel:Number = 100;
var fuelDecrease:Number = 5;
if (put your key code or something here)
fuel -= fuelDecrease;
hope this helps
@HouseHero the questions you are asking are too broad, work with one at a time until you solve the function then move on to the next
THIS LINK will get you started with angles and direction
PART 2 goes more in depth on the power added to shot and hitTest
once you understand how these basic things work you will be putting together games in no time.
I know how to add and remove child. But how can I support multiple instances like I add a Child I want to make it shoot to other symbols. Can Anyone help me in AS3
//speed of bullet
var bulletSpeed:Number = = 10;
//distance to hero
var bulletX:Number = enemy.x - hero.x;
var bulletY:Number = enemy.y - hero.y;
var radians:Number = Math.atan2(bulletY, bulletX);
//angle 180 might need to be changed depending on the direction of the bullet MC
var angle:Number = radians * 180 / Math.PI;
//rotate bullet to angle
//new pos to hero
var newBulletX:Number = Math.cos(radians);
var newBulletY:Number = Math.sin(radians);
//move bullet * bullet speed
bullet.x -= newBulletX * bulletSpeed;
bullet.y -= newBulletY * bulletSpeed;
I just typed this and did not test, sample on request
oop forgot the bullet rotation...
//rotate bullet to angle
bullet.rotation = angle;
once you have figured out 1 enemy with bullet fire you can then implement this technique HERE
You must be logged in to post a reply!
We strive to deliver the best gaming experiences on the internet and on your mobile phone. Play thousands of free online games, get access to free mmorpg games, online rpg games, fun online flash games, and more.
We offer free flash games in many different genres: online shooting games, online puzzle games, online war games, free online car games, free online hidden object games and dozens more.
This is the best place on the web to play online games for free! No matter what game style you prefer, we've got it here.
Want to advertise on Armor Games? Send us a note!
Gaming websites, passionate bloggers, and quirky streamers are welcome to share or review our games. If you need game keys, art, trailers, screenshots or more check out our press kit website.
Game developer? Visit developers.armorgames.com to request AG developer status, find documentation on our APIs, and get access to our development environment. Let's make sweet, sweet games together.
Looking for a publishing partner that can help your app rocket to success? Contact the mobile team to learn more about how we can help!