Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
21 May, 2013, 09:27:56 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2   Go Down
  Print  
Author Topic: remplacer des tiles -  (Read 1039 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Belette furtive
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 08 September, 2012, 17:06:58
Date Registered: 16 October, 2011, 16:25:57
Posts: 17

Topic starter
Total Post Ratings: 0

View Profile
« on: 09 November, 2011, 18:58:55 »
0

Bonjour à tous. Je tente de faiire un programme où le joueur doit ramasser des clés pour débloquer des portes et supprimer les ennemis.
J'ai fait la map, une touche pour frapper et ai placé  des clefs sur la map.
En fait, le problème, c'est que je ne sais pas comment supprimer les portes quand on passe dessus sauf en stockant le numéro de la tile du sol dans le nombre d'octet de l'image de la porte après le pointeur.
Cette technique ne marche que pour une porte en particulier, comment faire pour que cela fonctionne quelle que soit la porte ?
Logged
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Today at 07:12:46
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2045


Total Post Ratings: +254

View Profile
« Reply #1 on: 09 November, 2011, 19:07:47 »
0

La porte doit etre supprimée quand tu marche dessus avec une clé
ou
Toutes les portes doivent etre supprimées quand tu as une clé
?

Dans le deuxieme cas, tu peux utiliser une boucle for du genre
For(r1,0 ou 1,taille de la map)
  .le 0 ou 1 depend de comment tu fais ta tilemap
  If {...}=porte
    rien→{...}
  End
End


Dans le premier cas, je pense que tu peux accéder a l'octet qui t'interesse en faisant {Y/(largeur map)*(largeur map)+X} ou X et Y sont les coordonnées du personnage mais cela n'est pas sur. Il ya peut etre une faute de calcul.
« Last Edit: 09 November, 2011, 19:16:10 by Hayleia » Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Belette furtive
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 08 September, 2012, 17:06:58
Date Registered: 16 October, 2011, 16:25:57
Posts: 17

Topic starter
Total Post Ratings: 0

View Profile
« Reply #2 on: 11 November, 2011, 14:16:29 »
0

Plutôt le 1er cas.
En fait, je voudrais que quand on a au moins une clé et que on passe sur une porte, elle soit supprimée (ça je sais le faire)
mais aussi que cela fonctionne quelle que soit la porte et sa position sur la carte.
Logged
Wellen
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 02 May, 2012, 11:56:34
Date Registered: 08 August, 2011, 11:00:09
Location: France
Posts: 118


Total Post Ratings: +5

View Profile
« Reply #3 on: 11 November, 2011, 15:03:42 »
0

Ce qu'il faut faire, comme le dit Hayleia (t'as vu jme suis pas trompé Tongue), c'est réussir à trouver une relation entre les coordonnées de la porte sur laquelle est le personnage (donc les coordonnées du personnage), la largeur et la hauteur de la map, pour accéder au bon octet. Tu cherches d'abord à savoir dans quelle ligne de ton tableau tu te trouves, puis tu y ajoutes ta coordonnée en colonnes (X)
ça doit plutôt être si je ne me trompe pas :
[ ( Y/(hauteur) ) * (largeur+1) ] + X

Logged

-/...././/--./.-/--/.
I'm french, so please feel free to correct my bad english, it'd help me a lot Wink
Spoiler for Feat. Loulou54:
Spoiler for Projects:
Spoiler for Axe:
Ti-Lock : Lock your calc before turning it off               [XXXXXXXX--] 80%
Spoiler for Ti-Basic:
Spoiler for Soko-Ti, a sokoban game in Ti-Basic:

Spoiler for Memory:

Downloads here.
Belette furtive
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 08 September, 2012, 17:06:58
Date Registered: 16 October, 2011, 16:25:57
Posts: 17

Topic starter
Total Post Ratings: 0

View Profile
« Reply #4 on: 11 November, 2011, 16:02:43 »
0

Donc, pour une map de 36*16 Tiles avec le dessin du sol qui porte le numéro 0, je devrais avoir : 
0→{((B/16)*(36+1))+A}
Où A et B sont les coordonnées de mon personnage ?
Logged
Wellen
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 02 May, 2012, 11:56:34
Date Registered: 08 August, 2011, 11:00:09
Location: France
Posts: 118


Total Post Ratings: +5

View Profile
« Reply #5 on: 11 November, 2011, 16:22:20 »
0

Si ma méthode est juste, oui Smiley
je te conseille quand même de faire des essais (avec des emplacement extrêmes genre les bords de maps, et des emplacements dont tu connais l'emplacement exact dans les octets, et de comparer avec ce que ça donne) et de me dire si je me suis planté ^^

Après, tu peux évidemment optimiser, c'était pour que ça soit clair toutes ces horribles parenthèses
Logged

-/...././/--./.-/--/.
I'm french, so please feel free to correct my bad english, it'd help me a lot Wink
Spoiler for Feat. Loulou54:
Spoiler for Projects:
Spoiler for Axe:
Ti-Lock : Lock your calc before turning it off               [XXXXXXXX--] 80%
Spoiler for Ti-Basic:
Spoiler for Soko-Ti, a sokoban game in Ti-Basic:

Spoiler for Memory:

Downloads here.
Belette furtive
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 08 September, 2012, 17:06:58
Date Registered: 16 October, 2011, 16:25:57
Posts: 17

Topic starter
Total Post Ratings: 0

View Profile
« Reply #6 on: 13 November, 2011, 18:37:09 »
0

Je pense que tu t'es planté  Grin

J'ai fait plusieurs essais en modifiant les coordonnées, la formule, les variables utilisées... mais rien ne marche. Frustrated
Par contre, ça fait toujours un changement mais jamais sur les bon octets.

Voilà le code si ça peut aider.

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
.GAU

0→{L₁+2}→{L₁+5}→{L₁+8}→{L₁+11}

2→{L₁}
1→{L₁+1}
21→{L₁+3}
1→{L₁+7}

11→{L₁+4}
14→{L₁+10}
34→{L₁+6}
25→{L₁+9}

.emplacemennt des clés


0→B→A
.Coordonnées du personnage sur la carte

1→U
2→V
.Coordonnées du personnage sur l'écran


0→Z
.Suivant la valeur de Z, un des 4 sprites de l'épée sera choisi


[000040FF40000000]→Pic3
[000002FF02000000]
[081C080808080808]
[1010101010381010]
.l'arme du personnage


[6142245868605050]→Pic2
[8642241A16060A0A]
[4C524C5EED8C1233]
[327A327AB73248CC]
.le personnage


Lbl DPL
Repeat getKey(15)
If getKey(3)
If (sub(ZIP,A+U+1,B+V)→r₁=0
0→Z
If A<24 and (U=5)
A+1→A
ElseIf U<11
U+1→U
End
ElseIf r₁=2
sub(POR)
End
End
If getKey(2) and (sub(ZIP,A+U-1,B+V)=0
1→Z
If (U=5) and (A>0)
A-1→A
ElseIf U>0
U-1→U

End
End
If getKey(1) and (sub(ZIP,A+U,B+V+1)=0
2→Z
If B<8 and (V=4)
B+1→B
ElseIf V<7
V+1→V

End
ElseIf getKey(4) and (sub(ZIP,A+U,B+V-1)=0
3→Z
If B>0 and (V=4)
B-1→B
ElseIf V>0
V-1→V
End
End


DispGraph
ClrDraw
sub(TLM
sub(CLE)
Pt-Off(U*8,V*8,Z*8+Pic2

If getKey (54)
If Z=0
8→E
0→S→L
ElseIf Z=1
-8→E
0→S
1→L
ElseIf Z=2
0→E
8→S
2→L
ElseIf Z=3
0→E
-8→S
3→L
End
Pt-On(U*8+E,V*8+S,L*8+Pic3
End
End
Return
.la getkey 54 gère l'attaque


[0000000000000000]→Pic1
.le sol

[463971918A858989]
.les murs

[2424241818242424
.les barrieres

[111111111111111111111111111111111111]→GDB1
[100100000000000000000000000000010001]
[100100100111100000000000000000010001]
[100100100111111100111001111001210001]
[100100100000000000110000000001010001]
[100100100000000000111001100001010001]
[100200111111111100000001100001010001]
[100200001110000100000001100001000001]
[100100001110000100111101100111100001]
[100100000020000000110001100000111111]
[100100000020000000110111111100000001]
[100100001110000100110011000000000001]
[100101111110000100111111010011111001]
[100101111111110100000000100011111001]
[100100000000000100000000100111111001]
[111111111111111111111111111111111111]


Lbl CLE
0→r₅
For(r₁,0,3)
{r₁*3+L₁→r₄}-A→r₂
{r₄+1}-B→r₃
If r₂=U and (r₃=V) and ({r₄+2}=0)
{r₄+2}+1→{r₄+2}
End
!If {r₄+2}
If r₂<12 and (r₃<8
Pt-Off(r₂*8,r₃*8,[0000E0BFE5000000]
End
Else
r₅+1→r₅
End
End
Return

.Ce label gère les clés


Lbl POR
0→{((B/16)*(36+1))+A+GDB1}
Return
.Celui ci doit gérer les portes


Lbl TLM
For(Y,0,8
For(X,0,11
sub(ZIP,X+A,Y+B)→r₁
Pt-On(X*8,Y*8,r₁*8+Pic1)
End
End
DispGraph
Return

Lbl ZIP
r₂*36+r₁→r₁
{r₁/2+GDB1}→r₂
If r₁^2
r₂^16
Else
r₂/16
End
Logged
annoyingcalc
the annoying calculator
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 05:48:46
Date Registered: 14 April, 2011, 23:02:24
Location: In the glorious land of minecraft
Posts: 1778


Total Post Ratings: +57

View Profile WWW
« Reply #7 on: 13 November, 2011, 18:53:07 »
0

Bienvenue S'il vous plaît présenter votre auto http://www.omnimaga.org/index.php?board=10.0
Logged

Click here to see where you got your post ratings

My minecraft server is usually up, even if mcserverlist says it is down

Spoiler for siq:
Spoiler for signature:
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Today at 07:12:46
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2045


Total Post Ratings: +254

View Profile
« Reply #8 on: 13 November, 2011, 20:13:35 »
0

Bienvenue S'il vous plaît présenter votre auto http://www.omnimaga.org/index.php?board=10.0
shocked
...votre auto...
Big smile
Je pense qu'il y a un probleme de traduction pour "yourself". C'est evidemment toi qu'il faut présenter, pas ton auto, mais je pense que tout le monde avait compris.
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Belette furtive
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 08 September, 2012, 17:06:58
Date Registered: 16 October, 2011, 16:25:57
Posts: 17

Topic starter
Total Post Ratings: 0

View Profile
« Reply #9 on: 13 November, 2011, 20:14:10 »
0

Voilà qui est fait (bien que avec un peu retard).

PS: tout va bien, j'avais compris!
« Last Edit: 13 November, 2011, 20:17:28 by Belette furtive » Logged
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Today at 07:12:46
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2045


Total Post Ratings: +254

View Profile
« Reply #10 on: 13 November, 2011, 20:21:13 »
0

Pour le retard, tout est relatif. Ma presentation n'est arrivée que vers les 30 posts Big smile
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Belette furtive
LV1 Newcomer (Next: 20)
*
Offline Offline

Last Login: 08 September, 2012, 17:06:58
Date Registered: 16 October, 2011, 16:25:57
Posts: 17

Topic starter
Total Post Ratings: 0

View Profile
« Reply #11 on: 13 November, 2011, 20:43:04 »
0

Quelle rapidité exceptionnelle !!
Logged
annoyingcalc
the annoying calculator
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 05:48:46
Date Registered: 14 April, 2011, 23:02:24
Location: In the glorious land of minecraft
Posts: 1778


Total Post Ratings: +57

View Profile WWW
« Reply #12 on: 13 November, 2011, 21:01:58 »
0

Bienvenue S'il vous plaît présenter votre auto http://www.omnimaga.org/index.php?board=10.0
shocked
...votre auto...
Big smile
Je pense qu'il y a un probleme de traduction pour "yourself". C'est evidemment toi qu'il faut présenter, pas ton auto, mais je pense que tout le monde avait compris.
Désolé je utiliser Google translate
Logged

Click here to see where you got your post ratings

My minecraft server is usually up, even if mcserverlist says it is down

Spoiler for siq:
Spoiler for signature:
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Today at 07:12:46
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2045


Total Post Ratings: +254

View Profile
« Reply #13 on: 13 November, 2011, 21:19:57 »
0

Quelle rapidité exceptionnelle !!
En fait, moi personne ne m'a dit de me présenter Big frown donc j'ai du decouvrir le board par moi même, d'où la lenteur Wink

Désolé je utiliser Google translate
Yeah, we saw that Big smile
No, seriously, Google translate is understandable, and you wanted to help, so don't apologize for nothing Smiley
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 08:22:03
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50208


Total Post Ratings: +2612

View Profile WWW
« Reply #14 on: 14 November, 2011, 06:17:12 »
0

Il est généralement préférable en anglais par contre de vérifier sa grammaire et son orthographe avant de traduire, sinon ça donne des résultats encore moins jolis Tongue
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.274 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.