<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Foosball Game Help' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Foosball Game Help' posted on the 'Flash development' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 19:24:06 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 19:24:06 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Foosball Game Help</title>
      <link>http://www.programmersheaven.com/mb/flash/413833/413833/foosball-game-help/</link>
      <description>Could anyone help me with creating a flash foosball game for actionscript 2.0?  Need to hand in a brief  on Friday and mine is really not working.  Please if someone could read through this code and correct me or can anyone provide me with any script for the game?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have created 6 enemies with rectangles inside them that are the hitTests for the ball.  The same with my characters.   This is the code on my frame.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
onLoad = function() {&lt;br /&gt;
	enemyScore = 0;&lt;br /&gt;
	yspeed = 0;&lt;br /&gt;
	xspeed = 0;&lt;br /&gt;
	friction = 5;&lt;br /&gt;
	gravity = 5;&lt;br /&gt;
	thrust = 5;&lt;br /&gt;
	xspeed *= friction;&lt;br /&gt;
	yspeed += gravity;&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
onEnterFrame = function () {&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	_root.ball._y += yspeed;&lt;br /&gt;
_root.ball._x += xspeed;&lt;br /&gt;
	_root.ball._rotation += xspeed;&lt;br /&gt;
	//collision detection &lt;br /&gt;
&lt;br /&gt;
	enemyScoreText.text = enemyScore;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
//Char01&lt;br /&gt;
	if (_root.ball.hitTest(_root.men.char.charTOP)) {&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.men.char.charBOT)) {&lt;br /&gt;
		_root.ball._y -= yspeed*-25;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.men.char.charLEFTtop)) {&lt;br /&gt;
		_root.ball._x -= 100;&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.men.char.charLEFTbot)) {&lt;br /&gt;
		_root.ball._x -= 100;&lt;br /&gt;
		_root.ball._y += -yspeed*-25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.men.char.charRIGHTtop)) {&lt;br /&gt;
		_root.ball._x += 100;&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.men.char.charRIGHTbot)) {&lt;br /&gt;
		_root.ball._x += 100;&lt;br /&gt;
		_root.ball._y += -yspeed*-25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
//the code is the same as the above for the reset of the characters respectively &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//enemies&lt;br /&gt;
//Enemies01&lt;br /&gt;
	if (_root.ball.hitTest(_root.enemies.enemies1.charBOT
)) {&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.enemies.enemies1.charTOP
)) {&lt;br /&gt;
		_root.ball._y -= yspeed*-25;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.enemies.enemies1.charLEF
Tbot)) {&lt;br /&gt;
		_root.ball._x -= 100;&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.enemies.enemies1.charLEF
Ttop)) {&lt;br /&gt;
		_root.ball._x -= 100;&lt;br /&gt;
		_root.ball._y += -yspeed*-25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.enemies.enemies1.charRIG
HTbot)) {&lt;br /&gt;
		_root.ball._x += 100;&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.enemies.enemies1.charRIG
HTtop)) {&lt;br /&gt;
		_root.ball._x += 100;&lt;br /&gt;
		_root.ball._y += -yspeed*-25;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
//the code is the same as the above for the reset of the enemies respectively &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//restrictions&lt;br /&gt;
	if (_root.ball.hitTest(_root.groundBottom)) {&lt;br /&gt;
		_root.ball._y -= yspeed*25;&lt;br /&gt;
		_root.ball._x -= xspeed*25;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	if ((_root.ball.hitTest(_root.groundLeft))&amp;amp;&amp;amp;(_root.ba
ll._x &amp;lt; 0)) {&lt;br /&gt;
		_root.ball._x += 120;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	if ((_root.ball.hitTest(_root.groundRight))&amp;amp;&amp;amp;(_root.b
all._x &amp;gt; 0)) {&lt;br /&gt;
		_root.ball._x += -120;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	if (_root.ball.hitTest(_root.groundTop)) {&lt;br /&gt;
		_root.ball._y += yspeed*25;&lt;br /&gt;
		_root.ball._x += xspeed*25;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
//goals&lt;br /&gt;
	if (_root.ball.hitTest(_root.homeGoal)) {&lt;br /&gt;
		enemyScore++;&lt;br /&gt;
		&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//This is the code on my characters.&lt;br /&gt;
onClipEvent (load) {&lt;br /&gt;
	rotate = 0;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
onClipEvent (enterFrame) {&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	if (Key.isDown(Key.RIGHT)) {&lt;br /&gt;
		this._x += 15;&lt;br /&gt;
	}&lt;br /&gt;
	if (Key.isDown(Key.LEFT)) {&lt;br /&gt;
		this._x -= 15;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//This is the code on my enemies.&lt;br /&gt;
onClipEvent (load) {&lt;br /&gt;
	enemyspeed = 2;&lt;br /&gt;
	enemystepsright = 0;&lt;br /&gt;
	enemystepsleft = 0;&lt;br /&gt;
	enemydir = "left";&lt;br /&gt;
}&lt;br /&gt;
onClipEvent (enterFrame) {&lt;br /&gt;
&lt;br /&gt;
	if (this.hitTest(_root.groundLeft)) {&lt;br /&gt;
		enemyspeed = 0;&lt;br /&gt;
		enemystepsright = 0;&lt;br /&gt;
		enemystepsleft = 0;&lt;br /&gt;
		dead = true;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if (!dead) {&lt;br /&gt;
		if (enemydir == "right") {&lt;br /&gt;
			enemystepsright += 0.5;&lt;br /&gt;
			this._x += enemyspeed;&lt;br /&gt;
		} else if (enemydir == "left") {&lt;br /&gt;
			enemystepsleft += 0.5;&lt;br /&gt;
			this._x -= enemyspeed;&lt;br /&gt;
		}&lt;br /&gt;
		if (enemystepsright == 50) {&lt;br /&gt;
			enemystepsright = 0;&lt;br /&gt;
			enemydir = "left";&lt;br /&gt;
		} else if (enemystepsleft == 50) {&lt;br /&gt;
			enemystepsleft = 0;&lt;br /&gt;
			enemydir = "right";&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/flash/413833/413833/foosball-game-help/</guid>
      <pubDate>Wed, 24 Feb 2010 07:31:37 -0700</pubDate>
      <category>Flash development</category>
    </item>
  </channel>
</rss>