All-in-One Solitaire released

Game can be played at the same address: All-in-One Solitaire.
I didn’t intend to sell it to any sponsors, just made it for my website.
Solitaire is quite an ordinary game, but as it’s a classic game, many people like it and play it often.
I will submit the game to portals later this week.

з.ы.: One of the cool features of my game 🙂 is internet radios, that you can listen while playing.


WCK. Conveyor belt problem.

For Dolly The Sheep game I’m using WCK + Box2D Alchemy Port.
It’s a very handy framework, but unfortunately, it lacks documentation and has some bugs.
One of the bugs, I have recently discovered was with the build-in Conveyor belt.
Here is an example.
There are 3 boxes, they should move to the same direction, while they are lying on the conveyor, but… their behavior is unpredictable.

I’ve decided to make my own simple Conveyor Belt, by listening Contact Events.
Here is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
public override function create():void
{
	friction = 0; //this is very important, otherwise objects on conveyor will be moving with different speed
	reportBeginContact = true;
	reportEndContact = true;
 
	super.create();
 
	listenWhileVisible(this, ContactEvent.BEGIN_CONTACT, onBeginContact);
	listenWhileVisible(this, ContactEvent.END_CONTACT, onEndContact);
}
 
public override function update(param:Param):void //your own update function, calls every frame
{
	//set velocity to objects lying on the conveyor belt, I'm only using horizontal velocity here
	//_dir - direction, where object on conveyor should move to
	//_shape._normal - only the "y" of the normal, when object has contacted conveyor, in my case it can be only 1(from above) or -1(from below)
	for each(_shape in _shapes) //go through all the objects, contacting conveyor
	{
		_shape2 = _shape._shape;
		_shape2.b2body.SetLinearVelocity(new V2(_dir*_shape._normal*_speed, 0));
	}
}
 
protected function onBeginContact(event:ContactEvent):void
{
	//add object and its contact normal to the list
	//event.other.m_userData - our object
	//event.normal - our normal of the contact, that points from conveyor belt to object
	//if event.normal.y > 0, object has contacted conveyor from below
	//if event.normal.y  0 ? -1 : 1)));
}
 
protected function onEndContact(event:ContactEvent):void
{
	//remove object, that is not contacting with conveyor from the list
	...
}

Of course, my version has some problems too, mainly because of the zero friction.
Hope, new version of Box2D Alchemy Port with fixed bugs will be released soon.


DISCLAIMER: The content in this blog represents the opinion of the author. No information here should be used for any purpose except for entertainment.