Author Topic: Detector colision probleme  (Read 5033 times)

0 Members and 1 Guest are viewing this topic.

Offline Progammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 68
  • Rating: +9/-0
    • View Profile
Detector colision probleme
« on: June 18, 2011, 10:13:20 am »
I started creating a game where a guy moves with an acceleration. I get to manage packages from the right but not those from the left. My algorithm is as follows:
It asks whether the 8 pixels on the right (or left) are put out. If so, we go to the following 8 pixels (more on the right or left). If a pixel is on, is stored (the difference between the abscissa of the pixel and the abscissa of the man) in the acceleration.

A is the horizontal acceleration
(X,Y) are the guy's coordonates
The routine works (right):

:Lbl DRO
:for(O,X+8,X+8+A
:For(Z,0,7
:If Pxl-Test(O,Z+Y
:O-8-X->A
:Return
:End
:End
:End
:Return

The routine that is the problem

:Lbl GAU
:O=X-1
:Repeat O=X+A-2
:For(Z,0,7
:If Pxl-Test(O,Z+Y
:O-X+1->A
:Return
:End
:End
:O-1->O
:End
:Return
 
Here I can't use a For( because I decrease O .

When my guy goes to a wall on the right, it is stopped against it and an acceleration of 0. But when he goes to a wall to the left, it passes through as if the routine did not work. I need help please!  :banghead:

Check out my New Axe game : Wormsblock http://www.omnimaga.org/index.php?topic=8393.msg154258#msg154258
Any suggest would be welcome :)

<a href="http://www.nerdtests.com/ft_nt2.php">
<img src="http://www.nerdtests.com/images/badge/nt2/e1c7a850d530fb8e.png" alt="NerdTests.com says I'm a Cool Light-Weight Nerd.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!">
</a>
Have fun !

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Detector colision probleme
« Reply #1 on: June 18, 2011, 04:36:26 pm »
Code: [Select]
O=X-1 ???
I think, if it's really what you wrote, the mistake :D
Code: [Select]
X-1->O

Offline Progammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 68
  • Rating: +9/-0
    • View Profile
Re: Detector colision probleme
« Reply #2 on: June 18, 2011, 06:39:25 pm »
Omg How stupid I am ! Yes I really wrote this ... Thank you :)

Edit : this still doesn't woks :(
« Last Edit: June 18, 2011, 06:46:10 pm by Progammer »
Check out my New Axe game : Wormsblock http://www.omnimaga.org/index.php?topic=8393.msg154258#msg154258
Any suggest would be welcome :)

<a href="http://www.nerdtests.com/ft_nt2.php">
<img src="http://www.nerdtests.com/images/badge/nt2/e1c7a850d530fb8e.png" alt="NerdTests.com says I'm a Cool Light-Weight Nerd.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!">
</a>
Have fun !

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Detector colision probleme
« Reply #3 on: June 18, 2011, 07:33:15 pm »
Don't forget order of operations is strictly left to right.  Change O=X+A-2 to X+A-2=O.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Progammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 68
  • Rating: +9/-0
    • View Profile
Re: Detector colision probleme
« Reply #4 on: June 18, 2011, 08:26:24 pm »
Thank's a lot ! It works :D btw congratulation for the Axe project :)
Check out my New Axe game : Wormsblock http://www.omnimaga.org/index.php?topic=8393.msg154258#msg154258
Any suggest would be welcome :)

<a href="http://www.nerdtests.com/ft_nt2.php">
<img src="http://www.nerdtests.com/images/badge/nt2/e1c7a850d530fb8e.png" alt="NerdTests.com says I'm a Cool Light-Weight Nerd.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!">
</a>
Have fun !

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Detector colision probleme
« Reply #5 on: June 19, 2011, 12:31:18 pm »
I also recommend you to use parentheses in pixel testing, I've had some issues with that.

Offline Progammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 68
  • Rating: +9/-0
    • View Profile
Re: Detector colision probleme
« Reply #6 on: June 19, 2011, 01:13:51 pm »
Ok thank you
Check out my New Axe game : Wormsblock http://www.omnimaga.org/index.php?topic=8393.msg154258#msg154258
Any suggest would be welcome :)

<a href="http://www.nerdtests.com/ft_nt2.php">
<img src="http://www.nerdtests.com/images/badge/nt2/e1c7a850d530fb8e.png" alt="NerdTests.com says I'm a Cool Light-Weight Nerd.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!">
</a>
Have fun !