Copy link to clipboard
Copied
Hi All,
This is just a personal project as I want to learn how to create side scroller games fro IOS and Android.
I am pretty much brand new to AS3, I have used flash in the past to create simple banner adverts but not for a game.
I have found a pretty good tutorial on creating a side scrolling game like 'Flappy Bird' and I know with some tweaks I can change it so it doesn't resemble it.
The tutorial how ever does not show how to randomly generate obstacles, it only shows how to keep telling the certain obstacles to go back to a certain point on the 'x' axis.
I would like to create 5 obstacles and have them randomly be placed on the 'Y' axis and then move across the screen so the user has to dodge between them by clicking/tapping on screen.
Any help or another link to a tutorial would be much appreciated.
Thanks fro the help.
Alex
Copy link to clipboard
Copied
What aspect of what you want to do are you having difficulty with?
Copy link to clipboard
Copied
‌I want to create 5 obstacles that randomlay generate at different points of the y axis. I then want these obstaclues to move from right to left of the screen that have to be dodged. I don't know where to start with creating any of the effect described.
any tutorial you might know of would be a great help. Or any tutorial explaining the whole flappy bird build.
cheers
Copy link to clipboard
Copied
Your best bet will be to tackle one aspect of it at a time - first look into how to add objects dynamically. The basics of that are to create an object that you store in the library and assign it a class ID via its Properties option (left click it in the library for that option). Then when you want to add a new instance of it you can use...
var newThing:ClassIDYouAssigned = new ClassIDYouAssigned();
addChild(newThing);
You can assign its x and y properties before adding it as a child.
newThing.x = someValue;
newThing.y = .... // look into using the Math.random() method to randomly assign it a y location
You can always wait to see if someone comes along and does your work for you - some people will.
Copy link to clipboard
Copied
‌Thank you for the initial help! I will look into what you have suggested
Copy link to clipboard
Copied
When you get that figured out and want to see how to move things using AS3 then a good place to turn to solve most any design element is Google. I have relied on it for almost 15 years for Flash help. When it comes to searching for help with AS3 coding Google works great if you simply use "AS3 your goal" where "your goal" is whatever you are trying to do. In this case "AS3 move object" is likely to get you the answers/tutorials you need... and it never hurts to put the word "tutorial" in the search as well if you want to see if someone has prepared something to walk you thru a task.
Copy link to clipboard
Copied
I agree with Ned! I Google 'as3 whatever' like five times a day typically. Sometimes way more... Anyway, I wanted to say I'd make a class for your game object. Then each object can watch its own x axis, place itself initially in y, have random speed, etc., etc.
Also on Ned's example:
var newThing:ClassIDYouAssigned = new ClassIDYouAssigned();
Personally, I like to do like so and use MovieClip as the class type:
var newThing:MovieClip = new ClassIDYouAssigned();
This way when I look at the code, I know it's a Flash movieClip and not an instance of some class.