Hello everyone!
I'm currently at SCAD (the Savannah College of Art and Design) with a major in video game design. As I prefer a shotgun approach to game creation, I've decided to learn how to program in Flash as well as the usual 3D stuff.
My current project is that we have to move a movieclip around the stage without using any user inputs or tween animations. In addition, we have to have the values of the movieclip be affected in some form or fashion (the x/y co-ordinates, alpha levels, scale, etc).
To give you an idea, I've created a little robot sprite that dashes megaman style from left to right across the stage. He starts in the middle of the stage and has solid platforms above and below him, making the layout three total tiers. When he reaches the end of the stage, he then backdashes from right to left. Wash, rinse, repeat.
Currently, I have a separate rock shape movieclip that travels left to right across the stage. When the robot comes within a certain distance of the rock, I programmed the robot to move up to avoid the rock. What I want to happen is that the robot will always move down to avoid a rock on the top level, up or down in the middle level, and up on the bottom level.
Any advice on what I should do? Code can be posted to clear things up.
Thanks!
Also, if you are terribly interested in helping, I may bend your ear some more if further lingering questions should arise. Again, I'm new at this and can definitely use the help.
Need a voice actor? Hire me at bengrayVO.com
Legends of Runeterra: MNCdover #moc
Switch ID: MNC Dover SW-1154-3107-1051
Steam IDTwitch Page
Posts
Since you have three 'levels' on your stage and you spawn rocks in one of three discrete locations rolling horizontally, you should add variables that indicate the levels of your rock and your sprite. Assuming you have one rock at a time, you set the rockLevel (example) when the animation begins and clear it when it ends. You start your spriteLevel (example) at whatever middle is, and change it whenever it successfully changes levels.
Whenever the x of the rock is within (dangerDistance, or whatever) of the sprite, you compare the rockLevel and spriteLevel to see if the sprite needs to move. If he does, you look at the spriteLevel and decide to start a down transition if he's at the top, an up transition if he's at the bottom, or random(2) (or whatever you do to coin-flip it) if in the middle.
Does that help you out, conceptually?
Games: Ad Astra Per Phalla | Choose Your Own Phalla
Legends of Runeterra: MNCdover #moc
Switch ID: MNC Dover SW-1154-3107-1051
Steam ID
Twitch Page
I do a lot of work with ActionScript 3; you can PM me with pretty much any questions.
Math.ceil(Math.random()*n)) produces an integer between 1 and n.
So for instance:
Oh man, that's exactly what I needed. Prepare to have your PM box get hit up quite a bit. Not that I'm completely clueless, I just don't know the actual AC3 commands or prompts.
Thanks again guys!
Legends of Runeterra: MNCdover #moc
Switch ID: MNC Dover SW-1154-3107-1051
Steam ID
Twitch Page