Author Topic: [Axe parser] aide  (Read 73402 times)

0 Members and 1 Guest are viewing this topic.

Offline Kiligolo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 218
  • Rating: +10/-1
    • View Profile
Re: [Axe parser] aide
« Reply #165 on: November 09, 2010, 01:50:24 pm »
Conseil: aère tes codes.
Spoiler For Calcul Mental:
Version 1.3 :100%!!
Here is a program that reduces your dependence on the calculator! Click here!
Spoiler For Some screen shots:
       
The screenshots are in french but there is an english version

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: [Axe parser] aide
« Reply #166 on: November 09, 2010, 02:32:17 pm »
Juste pour te prévenir : les code dans un spoiler c'est incompatible chrome et chromium.

Pour ton code je vais faire en plusieurs étapes, d'abord on aère et on commente :
Code: [Select]
:.PERSO
:
:.DATA
:[{sprite du perso}]→Pic1
:[{sprite du mur}]→Pic2
:
:Lbl A
:.M=1, Y=32, X=47, E=?
:1→M+31→Y+15→X
:
:.Boucle principale
:Repeat getKey(15)
:If getKey(2)
:sub(COG)
:ClrDraw
:End
:
:If getKey(3)
:sub(COD)
:ClrDraw
:End
:
:If getKey(1)
:sub(COB)
:ClrDraw
:End
:
:If getKey(4)
:sub(COH)
:ClrDraw
:End
:
:sub(MAP)
:
:Pt-On(X,Y,E*8+Pic1)
:
:.On affiche 3 niveaux de gris ?
:DispGraphr
:
:End
:Goto Z
:
:Lbl MAP
:If M=1
:For(A,0,11)
:Pt-On(A*8,0,Pic2)
:If (A≠4) and (A≠5)
:Pt-On(A*8,56,Pic2)
:End
:End
:For(A,1,7)
:Pt-On(0,A*8,Pic2)
:Pt-On(88,A*8,Pic2)
:End
:End
:Return
:
:.Déplacement à gauche ?
:Lbl COG
:0→B
:For(A,0,7)
:!If Pxl-Test(X-1,Y+A)
:B+1→B
:If B=8
:X-1→X
:End
:End
:End
:Return
:
:.Déplacement à droite ?
:Lbl COD
:0→B
:For(A,0,7)
:!If Pxl-Test(X+9,Y+A)
:B+1→B
:If B=8
:X+1→X
:End
:End
:End
:Return
:
:.Déplacement en bas ?
:Lbl COB
:0→B
:For(A,0,7)
:!If Pxl-Test(X+A,Y+9)
:B+1→B
:If B=8
:Y+1→Y
:End
:End
:End
:Return
:
:.Déplacement en haut ?
:Lbl COH
:0→B
:For(A,0,7)
:!If Pxl-Test(X+A,Y-1)
:B+1→B
:If B=8
:Y-1→Y
:End
:End
:End
:Return
:
:.La fin du programme
:Lbl Z
:ClrDraw
:ClrDrawr
:DispGraph
:.Pourquoi DispGraph ici ?

Je te laisse m'expliquer les endroits ou il y a des points d'interrogations.

Je simplifie ton code pour une meilleur lecture :
Code: [Select]
:.PERSO
:
:.DATA
:[{sprite du perso}]→Pic1
:[{sprite du mur}]→Pic2
:
:Lbl A
:.M=1, Y=32, X=47
:1→M+31→Y+15→X
:
:.Boucle principale
:Repeat getKey(15)
:If getKey(2)
:sub(COG)
:sub(CLR)
:ElseIf getKey(3)
:sub(COD)
:sub(CLR)
:ElseIf getKey(1)
:sub(COB)
:sub(CLR)
:ElseIf getKey(4)
:sub(COH)
:sub(CLR)
:End
:
:sub(MAP)
:
:Pt-On(X,Y,Pic1)
:.Tu n'a qu'une sprite perso, alors je ne comprend pas le "+(E*8)"
:
:DispGraph
:
:End
:.La fin du programme
:ClrDraw
:Return
:
:Lbl CLR
:ClrDraw
:Return
:
:Lbl MAP
:If M=1
:For(A,0,11)
:Pt-On(A*8,0,Pic2)
:If (A≠4) and (A≠5)
:Pt-On(A*8,56,Pic2)
:End
:End
:For(A,1,7)
:Pt-On(0,A*8,Pic2)
:Pt-On(88,A*8,Pic2)
:End
:End
:Return
:
:.Déplacement à gauche ?
:Lbl COG
:sub(CO,X,-1,A,-1)
:Return
:
:.Déplacement à droite ?
:Lbl COD
:sub(CO,X,9,A,1)
:Return
:
:.Déplacement en bas ?
:Lbl COB
:sub(CO,Y,A,9,1)
:Return
:
:.Déplacement en haut ?
:Lbl COH
:sub(CO,Y,A,-1,-1)
:Return
:
:Lbl CO
:0→B
:For(A,0,7)
:!If Pxl-Test(X+r2,Y+r3)
:B+1→B
:If B=8
:r1+r4→r1
:End
:End
:End

Et c'est seulement maintenant que je vois "la chose" :o

Donc ton programme affiche des murs sur les bord, tu veux déplacer ton joueur de façon à ce qu'il s'arrête devant un mur (c'est un peu ça en gros, mais si tu avait caché des fonctions dans ton code, tu trouvera surement comment l'adapter).

Je te proposerai ce code qui va être plus facile à comprendre pour toi :
Code: [Select]
:.PERSO
:
:.DATA
:[{sprite du perso}]→Pic1
:[{sprite du mur}]→Pic2
:
:Lbl A
:1→M→Y→X
:
:.Boucle principale
:Repeat getKey(15)
:(getKey(3) and (X<11))-(getKey(2) and (X>1))+X→X
:(getKey(4) and (Y<7)-(getKey(1) and (Y>1))+Y→Y
:sub(MAP)
:Pt-On(X*8,Y*8,Pic1)
:DispGraph
:End
:Return
:
:
:Lbl MAP
:ClrDraw
:For(A,0,11)
:sub(ON,A*8,0)
:sub(ON,A*8,56)
:End
:For(A,0,7)
:sub(ON,0,A*8)
:sub(ON,88,A*8)
:End
:End
:Return
:
:Lbl ON
:Pt-On(r1,r2,Pic2)

Et encore la je reste gentil  ::)
Car le code le plus adapté ici est une map Data (voir lien plus haut).
« Last Edit: November 09, 2010, 02:34:50 pm by kindermoumoute »
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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Axe parser] aide
« Reply #167 on: November 09, 2010, 03:44:40 pm »
En passant bienvenue sur le forum Metallica. ;D
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: [Axe parser] aide
« Reply #168 on: November 10, 2010, 01:42:21 am »
Il est du forum espace TI lui aussi ;D
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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Axe parser] aide
« Reply #169 on: November 10, 2010, 02:39:47 am »
Ah je vois. Je vais surement aller m'inscrire là bas bientot, mais je ne sais pas si je serai super actif, à part dans les forums de projets et généraux, ayant abandonné la prog TI l'été passé et surtout avec l'approche des fêtes, je commence à avoir de la misère à trouver des trous dans la journée pour poster sur Omni tout en pouvant jouer à Starcraft :P
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Metallica

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +4/-0
    • View Profile
Re: [Axe parser] aide
« Reply #170 on: November 10, 2010, 06:45:16 am »
Merci pour le code Kindermoumoute mais si je désire rajouté des objets sur la map, il me semble que ça ne les prend pas en compte. J'irai peut être voir pour les datas si j'ai le temps.


Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: [Axe parser] aide
« Reply #171 on: November 10, 2010, 06:58:25 am »
Ah je vois. Je vais surement aller m'inscrire là bas bientot, mais je ne sais pas si je serai super actif, à part dans les forums de projets et généraux, ayant abandonné la prog TI l'été passé et surtout avec l'approche des fêtes, je commence à avoir de la misère à trouver des trous dans la journée pour poster sur Omni tout en pouvant jouer à Starcraft :P
Je te rassure tout de suite : il n'y a que 15 membres x).
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 Metallica

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +4/-0
    • View Profile
Re: [Axe parser] aide
« Reply #172 on: November 10, 2010, 08:32:43 am »
Tu n'as pas compris certaine chose dans mon programme car j'ai essayé de le réduire à l'essentiel, là où pouvait se trouvait le problème.

Code: [Select]
:.PERSO
:
:.DATA
:[{sprite du perso}]→Pic1
:[{sprite du mur}]→Pic2
:
:Lbl A
:.M=1, Y=32, X=47, E=? /// E c'était pour dire si le perso était tourné gauche, droite, haut, bas.  A la base il était à 0
:1→M+31→Y+15→X
:
:.Boucle principale
:Repeat getKey(15)
:If getKey(2)
:sub(COG)
:ClrDraw
:End
:
:If getKey(3)
:sub(COD)
:ClrDraw
:End
:
:If getKey(1)
:sub(COB)
:ClrDraw
:End
:
:If getKey(4)
:sub(COH)
:ClrDraw
:End
:
:sub(MAP)
:
:Pt-On(X,Y,E*8+Pic1)
:
:.On affiche 3 niveaux de gris ? //// Je mettais de l'herbe en gris dans le décor
:DispGraphr
:
:End
:Goto Z
:
:Lbl MAP
:If M=1
:For(A,0,11)
:Pt-On(A*8,0,Pic2)
:If (A≠4) and (A≠5)
:Pt-On(A*8,56,Pic2)
:End
:End
:For(A,1,7)
:Pt-On(0,A*8,Pic2)
:Pt-On(88,A*8,Pic2)
:End
:End
:Return
:
:.Déplacement à gauche ? /// oui
:Lbl COG
:0→B
:For(A,0,7)
:!If Pxl-Test(X-1,Y+A)
:B+1→B
:If B=8
:X-1→X
:End
:End
:End
:Return
:
:.Déplacement à droite ? /// oui
:Lbl COD
:0→B
:For(A,0,7)
:!If Pxl-Test(X+9,Y+A)
:B+1→B
:If B=8
:X+1→X
:End
:End
:End
:Return
:
:.Déplacement en bas ?  /// oui
:Lbl COB
:0→B
:For(A,0,7)
:!If Pxl-Test(X+A,Y+9)
:B+1→B
:If B=8
:Y+1→Y
:End
:End
:End
:Return
:
:.Déplacement en haut ?  ///oui
:Lbl COH
:0→B
:For(A,0,7)
:!If Pxl-Test(X+A,Y-1)
:B+1→B
:If B=8
:Y-1→Y
:End
:End
:End
:Return
:
:.La fin du programme
:Lbl Z
:ClrDraw
:ClrDrawr
:DispGraph
:.Pourquoi DispGraph ici ? /// parce que sinon ça donne l'impression que le programme lag lorsque j'archive l'appvar


Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: [Axe parser] aide
« Reply #173 on: November 10, 2010, 01:03:31 pm »
Je cherche une solution depuis tout à l'heure pour simplifier ce code :
Code: [Select]
:If getKey(20)
:8→I
:ElseIf getKey(28)
:7→I
:ElseIf getKey(36)
:6→I
:ElseIf getKey(19)
:5→I
:ElseIf getKey(27)
:4→I
:ElseIf getKey(35)
:3→I
:ElseIf getKey(18)
:2→I
:ElseIf getKey(26)
:1→I
:ElseIf getKey(34)
:0→I
:End

Pas d'idées ? ???
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 Kiligolo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 218
  • Rating: +10/-1
    • View Profile
Re: [Axe parser] aide
« Reply #174 on: December 05, 2010, 04:30:03 am »
Petite question: Combien peut-on faire de GDB dans un programme sans qu'il y ai une ERR:DUPLICATE?
Spoiler For Calcul Mental:
Version 1.3 :100%!!
Here is a program that reduces your dependence on the calculator! Click here!
Spoiler For Some screen shots:
       
The screenshots are in french but there is an english version

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Axe parser] aide
« Reply #175 on: December 05, 2010, 05:06:23 am »
Tu peux les nommer GDB0, GDB1, GDB2 et même GCB1A, GDB1B, etc. Sinon tu peux utiliser Str1, Pic1, etc. C'est la même chose en Axe.
« Last Edit: December 05, 2010, 05:08:34 am by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Kiligolo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 218
  • Rating: +10/-1
    • View Profile
Re: [Axe parser] aide
« Reply #176 on: December 05, 2010, 06:43:54 am »
Ok merci.

Cool: moi je me croyais limité à 10 GDB... ;D
Spoiler For Calcul Mental:
Version 1.3 :100%!!
Here is a program that reduces your dependence on the calculator! Click here!
Spoiler For Some screen shots:
       
The screenshots are in french but there is an english version

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: [Axe parser] aide
« Reply #177 on: December 05, 2010, 07:14:56 am »
De GDB0 à GDB9FF.

Edit : voir tuto partie pointeurs.
« Last Edit: December 05, 2010, 07:15:46 am by kindermoumoute »
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 Kiligolo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 218
  • Rating: +10/-1
    • View Profile
Re: [Axe parser] aide
« Reply #178 on: December 05, 2010, 08:00:13 am »
Ok merci!


Je fais un nouveau projet, mais il faut que j'en parle à personne d'accord?
« Last Edit: December 05, 2010, 08:00:48 am by Kiligolo »
Spoiler For Calcul Mental:
Version 1.3 :100%!!
Here is a program that reduces your dependence on the calculator! Click here!
Spoiler For Some screen shots:
       
The screenshots are in french but there is an english version

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: [Axe parser] aide
« Reply #179 on: December 05, 2010, 08:23:09 am »
Je fais un nouveau projet, mais il faut que j'en parle à personne d'accord?
Hm... antiphrase ?
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%