Actionscript 2.0, Moving a box?

Subscribe to Actionscript 2.0, Moving a box? 7 posts

avatar for enimy6 enimy6 9 posts
Flag Post

Bassicly I got a top view game.. just like pokemon or the old Zelda games. I have a box/square that I want to be able to move, when the player walks against it.. does anybody know how I should go on about this?

Please note, I have some developing experience.. but not ALOT, so please try to keep it slightly basic, that’d be great.
Thanks :)!

 
avatar for qwerber qwerber 4717 posts
Flag Post

I suggest you use AS3.

For AS2 you create a box, select it, convert it to a movieclip. click on the movieclip, and give it the instance name of _box.

click on the frame the box is in and press F9. type in:


onEnterFrame = function()
{
if(Key.isDwn(Key.LEFT) _box._x--;
}

there you have it

 
avatar for BraydenBlack BraydenBlack 271 posts
Flag Post

That actually wont work if you put it on the movieclips actions

onClipEvent(enterFrame) {
if(Key.isDown(Key.LEFT)) { _box._x -- }
}

But that will..^

 
avatar for enimy6 enimy6 9 posts
Flag Post

I really appreciate the help on this, however this dind’t solve my problem.

bassicly, this is exactly what I want:
bassicly, this is what I want:
http://www.youtube.com/watch?v=q_GYv6iZpIY

does anybody have an idea how this works at all?

 
avatar for qwerber qwerber 4717 posts
Flag Post
Originally posted by enimy6:

I really appreciate the help on this, however this dind’t solve my problem.

bassicly, this is exactly what I want:
bassicly, this is what I want:
http://www.youtube.com/watch?v=q_GYv6iZpIY

does anybody have an idea how this works at all?

You asked for box movement, not collision. We did solve your problem :(

If you want collision, you’ll have to know more about programming for robust collision algorithms.

 
avatar for BobJanova BobJanova 857 posts
Flag Post

In short, in the box’s collision handler, if it’s being pushed (i.e. in collision) from one side and not from the other, make it move away from the pushing. If you want to be able to push trains of boxes you can make that a general thing, otherwise you can make it so the collision must be from a mobile entity or from the player only.

You need to have a functional collision system first though.

 
avatar for enimy6 enimy6 9 posts
Flag Post

Sorry, I really wasn’t aware of what that ‘collision’ was called ,I thought Collision is just another word for hitTest (more or less). I thought this would be a, rather simple coding.. but I think this is still too much for me, I will have to drop this idea and replace it with something else.. thanks for taking your time trying to help me :)