ForumsProgramming ForumHi Guys, Need help :D

25 9943
MaTX
offline
MaTX
18 posts
Nomad

Hi! I want to make a game with some blocks but not tetris and i need a hand .
You know the minigame from professor layton?
http://i.ytimg.com/vi/WsRcWs_aBVI/0.jpg
In this one you have to change the position of the spheres, in mine you have to put a wooden block out of the game screen.

I started studying programming just a month ago and i'm a noob yet.
The first test i did i used this code to move a block:

[code]
public function DocumentClass()
{
block1 = new Block(100, 200);
addChild ( block1 );
block1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
block1.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}

public function mouseDownHandler(evt:MouseEvent):void
{
var object = evt.target;
// we should limit dragging to the area inside the canvas
object.startDrag();

}

public function mouseUpHandler(evt:MouseEvent):void
{
var obj = evt.target;
obj.stopDrag();
}
[/Code]

Whit this code i can move the block everywhere on the screen: that's not what i want.
How can i write a code that give me the possibility of moving on lines set in advance?
I explain better: the blocks have to move in only four directions: up, down, left and right and have to stop or don't move when collide with another block.

I know, i'm noob! That's why i'm here!
Thanks in advance

  • 25 Replies
MaTX
offline
MaTX
18 posts
Nomad

Sorry man i didn't see the answer.
This is the updated version:
http://nonmichiamofredo.altervista.org/BlockQuest/BlockQuestBase2.swf
I have to write a collisition code still.
Have you got any istant messaging program? Such as skype or msn?

plasmafish
offline
plasmafish
252 posts
Nomad

You have made some good progress with your game.

Now try adding obstacles and make the piece able to go right and left.

MaTX
offline
MaTX
18 posts
Nomad

The piece that goes right and left is another class called HorizzontalBlock, this is a VerticalBlock

plasmafish
offline
plasmafish
252 posts
Nomad

I don't have skype or msn though, but for collision detection and the coding behind that you should search for a tutorial or model something from flashkit.com. It really depends on what AS you are using and how you want to program your game. You may find that other ways are easier, but it really depends on how you want to code it.

plasmafish
offline
plasmafish
252 posts
Nomad

Also, make an instance of HorizontalBlock. Color it differently than the Vertical one.

MaTX
offline
MaTX
18 posts
Nomad

If you want i can send you by email .as files
I'm coding in actionscript 3 with flash cs4

MaTX
offline
MaTX
18 posts
Nomad

Ok, i will send you the link of a zip file.
Now i'm translating comments in english

MaTX
offline
MaTX
18 posts
Nomad
plasmafish
offline
plasmafish
252 posts
Nomad
MaTX
offline
MaTX
18 posts
Nomad

I will have a look

Showing 16-25 of 25