Author Topic: Correction Code  (Read 3940 times)

0 Members and 1 Guest are viewing this topic.

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
Correction Code
« on: May 09, 2012, 11:23:51 am »
It's me again, still trying to figure out bullets. I received some help form Derf, and it was very helpful, I feel that I am very close to figuring this out!
But I have a problem, I can't figure out what's wrong with this code, as it does not work for me...
Below is the code I received from Derf, if you could help me, it would be much appreciated :D
Code: [Select]
0->G
repeat getkey(15)
DispgraphClrdraw
For(G,1,I)               //Repeat code for every bullet
Pxl-Off{L1+(G*4)},{L1+(G*4)+1})      //Turn display for bullet off

If {L1+(G*4)+2}=1:{L1+(G*4)+1}-1->{L1+(G*4)+1}               //Depending on what direction bullet has, move it that way
End
If {L1+(G*4)+2}=2:{L1+(G*4)}+1->{L1+(G*4)}
End
If {L1+(G*4)+2}=3:{L1+(G*4)+1}+1->{L‚+(G*4)+1}
End
If {L1+(G*4)+2}=4:{L1+(G*4)}-1->{L1+(G*4)}
End:End

For(G,1,I)                                                   //Repeat code for every bullet
If pxl-Test({L1+(G*4)},{L1+(G*4)+1})            //If hits a lit up pixel (wall), move coordinates to 0,0 (storage)
0->{L1+(G*4)}->{L1+(G*4)+1}
Else
Pxl-On({L1+(G*4)},{L1+(G*4)+1})              //Otherwise, turn the bullet back on
End

I'm not entirely sure why this isn't working...
« Last Edit: May 09, 2012, 12:06:56 pm by hellninjas »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Correction Code
« Reply #1 on: May 09, 2012, 11:51:51 am »
Aren't there some ends missing at the end of the code? (two i think)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
Re: Correction Code
« Reply #2 on: May 09, 2012, 11:56:18 am »
I have those in my code, I guess I forgot to type them x.x

Offline Derf321

  • LV3 Member (Next: 100)
  • ***
  • Posts: 59
  • Rating: +0/-0
    • View Profile
Re: Correction Code
« Reply #3 on: May 11, 2012, 05:02:20 pm »
You need:

GetKey → K   //Should have this at start of program loop
If K=1          //If key pressed is down
1 → {L1+(G*4)+2}  //Store 1 to that bullets direction variable
End
If K=2.... etc.

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Correction Code
« Reply #4 on: May 11, 2012, 06:22:05 pm »
You need:

GetKey → K   //Should have this at start of program loop
If K=1          //If key pressed is down
1 → {L1+(G*4)+2}  //Store 1 to that bullets direction variable
End
If K=2.... etc.
Optimize it please x) :
Code: [Select]
GetKey
!If -1
.getKey=1
Else!If -1
.getKey=2
Else!If -1
.getKey=3
...
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Correction Code
« Reply #5 on: May 14, 2012, 10:31:44 pm »
You should just be using getKey() instead of the BASIC-style getKey->var :P

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
Re: Correction Code
« Reply #6 on: May 15, 2012, 07:46:19 am »
It's all in but I still can't get it to work ;.;