Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP][MySQL] Gra internetowa - Obrazki koło podpisów
Forum PHP.pl > Forum > PHP
corey
Witam! Zacznę od tego, że jestem tu nowy. Tworzę grę na silniku DEVANA i przerabiam plik hall.php TUTAJ ściągnij dąże do takiego efektu, żeby obrazki były koło opisów budynków tak jak tu: 

[IMG=http://img231.imageshack.us/img231/2864/35005387xz9.jpg][/IMG]




Więc doszedłem do tego wniosku, że trzeba zmienić to w bazie danych dopisać image ponieważ po wybudowaniu, czy też przed wybudowaniem na stronie nie ma jeszcze wszystkich budynków. 

ALTER TABLE `buildings` ADD `image` varchar(120) DEFAULT NULL

Więc zrobiłem tak:   

Pytanie co w pliku hall.php trzeba zmienić żeby mi wyświetlało obrazki budynków?



Z góry dziękuje i pozdrawiam (gg. 6593896)
wookieb
Sry ale nie mogę się powstrzymać od komentarza... To jak ty chcesz robić grę skoro nie umiesz tak banalnej rzeczy? Twoje pytanie jest nadwyraz proste i wykazuje twoją nieumiejętność analizy kodu i debugowania kodu. Nie chcę gasić twojego zapału lecz albo źle opisałeś problem (chodzi w rzeczywistości o inną rzecz) albo faktycznie nie masz podstaw wiedzy by brać się za tworzenie gry.
A co masz zrobic...
1) Wyświetl sobie print_r zawartosc zmiennej z listą budynków i zobacz czy juz tam nie ma linku do obrazka
2) Jezeli nie ma to sprawdz funkcje pobierajacą liste budynkow czy w zapytaniu pobiera takze kolumnę 'image'. Jak nie to dodaj tą kolumnę w zapytaniu.
corey
więc tak, jestem początkującym programistą, dopiero zaczynam swoją przygodę z pisaniem umiem html i css php troszkę, a że sie rzucam na głęboką wodę z grą to ja już niewiem. i tak kazdy bedzie mi pisal ze po co sie zabierasz za gre jak nic nie umiesz. ale ja tylko ten silnik edytuje i kilkanascie zmian wprowadziłem już i tylko jedno o co Was proszę to własnie to!

ten problem wygląda następująco:

Wchodząc na piękny przegląd graficzny, użytkownik chce coś wybudować klika na ratusz i wyskakują mu opisy budynków, chcę aby koło opisów budynków były obrazki. tylko to. prosze pomozcie.
wookieb
No przecież ci napisałem... Na samym koncu dodasz tylko zdjecie w tag IMG
Pokaż jak co robisz. Wklej nam wynik zastosowania
Kod
print_r($buildings);
corey
Array ( [0] => Array ( [0] => 0 [1] => 1 [2] => Grain mill-Farm [3] => [4] => 50-65-50-50-45 [5] => 20-40-60-80-100-120-140-160-180-200 [6] => 0:5-0:10-0:17-0:27-0:39-0:50-1:15-1:45-2:20-3:0 [7] => 3-1-2-2-3-3-3-3-5-5 [8] => At the grain mill farms are created and upgraded. Farms produce crop. [9] => 0 ) [1] => Array ( [0] => 1 [1] => 1 [2] => Lumber mill-Forest [3] => [4] => 65-50-50-45-45 [5] => 10-14-28-32-36-40-44-48-52-56 [6] => 0:3-0:8-0:14-0:24-0:32-0:46-1:6-1:35-2:0-2:49 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => At the lumber mill forests are managed. Forests produce lumber. [9] => 0 ) [2] => Array ( [0] => 2 [1] => 1 [2] => Stone mason-Quary [3] => [4] => 50-60-50-65-45 [5] => 10-14-28-32-36-40-44-48-52-56 [6] => 0:3-0:8-0:14-0:24-0:32-0:46-1:6-1:35-2:0-2:49 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => At the stone mason quaries are created and upgraded. Quaries produce stone. [9] => 0 ) [3] => Array ( [0] => 3 [1] => 1 [2] => Iron foundry-Ore site [3] => [4] => 50-60-65-50-45 [5] => 10-14-28-32-36-40-44-48-52-56 [6] => 0:3-0:8-0:14-0:24-0:32-0:46-1:6-1:35-2:0-2:49 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => At the iron foundry ore sites are created and upgraded. Ore sites produce iron. [9] => 0 ) [4] => Array ( [0] => 4 [1] => 1 [2] => Granary [3] => 0-1 [4] => 55-65-65-55-50 [5] => 800-1100-1800-2500-3600-5400-7100-9000-10000-11100 [6] => 0:10-0:20-0:40-0:55-1:20-1:55-2:45-3:25-4:05-5:0 [7] => 1-1-1-1-1-1-1-1-1-1 [8] => The granary stores crop. [9] => 0 ) [5] => Array ( [0] => 5 [1] => 1 [2] => Warehouse [3] => 1-1/2-1/3-1 [4] => 55-65-65-55-50 [5] => 600-900-1700-2700-4200-5800-7500-9300-10200-11500 [6] => 0:10-0:20-0:40-0:55-1:20-1:55-2:45-3:25-4:05-5:0 [7] => 1-1-1-1-1-1-1-1-1-1 [8] => The warehouse stores lumber, stone and iron. [9] => 0 ) [6] => Array ( [0] => 6 [1] => 1 [2] => Cache [3] => 4-1/5-1 [4] => 60-60-50-50-45 [5] => 500-1000-1600-2200-2700-3400-4300-5200-6100-7000 [6] => 0:10-0:20-0:40-0:55-1:20-1:55-2:45-3:25-4:05-5:0 [7] => 1-1-1-1-1-1-1-1-1-1 [8] => The cache stores certain amounts of resources, protecting them from enemy raids. [9] => 0 ) [7] => Array ( [0] => 7 [1] => 1 [2] => Town hall-Castle [3] => [4] => 70-70-80-60-55 [5] => 100-90-85-80-75-70-65-60-55-50 [6] => 0:20-0:30-0:50-1:35-2:00-2:55-3:45-4:25-5:05-6:0 [7] => 2-3-2-3-2-3-3-3-4-10 [8] => At the town hall you can build other structures and set taxes. The higher the level the faster constructions are completed and the bigger your vault will be. [9] => 0 ) [8] => Array ( [0] => 8 [1] => 1 [2] => House [3] => [4] => 60-60-50-50-45 [5] => 30-50-80-120-190-260-360-480-650-850 [6] => 0:5-0:10-0:17-0:27-0:39-0:50-1:15-1:45-2:20-3:0 [7] => 0-0-0-0-0-0-0-0-0-0 [8] => Here you provide living quarters for your population. [9] => 0 ) [9] => Array ( [0] => 9 [1] => 1 [2] => Embassy [3] => 7-3 [4] => 400-300-300-300-250 [5] => [6] => 1:7-1:7-1:7-1:7-1:7-1:7-1:7-1:7-1:7-1:7 [7] => 10 [8] => The embassy allows you to create alliances with other players. [9] => 0 ) [10] => Array ( [0] => 10 [1] => 1 [2] => Marketplace [3] => 7-3 [4] => 60-60-55-50-50 [5] => [6] => 0:5-0:10-0:17-0:27-0:39-0:50-1:15-1:45-2:20-3:0 [7] => 15-2-2-2-2-2-2-2-2-2 [8] => The marketplace allows you to trade resources and/or weapons with other players. The higher the level the more you can trade at a time. [9] => 0 ) [11] => Array ( [0] => 11 [1] => 1 [2] => Cathedral [3] => 7-7 [4] => 70-60-60-60-55 [5] => 20-30-40-50-60-70-80-90-100-110 [6] => 0:20-0:30-0:50-1:35-2:00-2:55-3:45-4:25-5:05-6:0 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => The cathedral boosts the morale of the town folk. [9] => 0 ) [12] => Array ( [0] => 12 [1] => 1 [2] => Port [3] => 9-1 [4] => 60-60-65-55-50 [5] => [6] => 1:30-1:30-1:30-1:30-1:30-1:30-1:30-1:30-1:30-1:30 [7] => 15-2-2-2-2-2-2-2-2-2 [8] => The higher the level the faster the ships are built. [9] => 0 ) [13] => Array ( [0] => 13 [1] => 1 [2] => Wall [3] => 17-1 [4] => 70-70-90-60-55 [5] => 10-15-20-25-30-35-40-45-50-55 [6] => 0:10-0:20-0:40-0:55-1:20-1:55-2:45-3:25-4:05-5:0 [7] => 3-1-1-2-3-2-3-3-4-4 [8] => The wall is a defensive structure. It boosts the defensive capabilities of the town in case of attack. [9] => 0 ) [14] => Array ( [0] => 14 [1] => 1 [2] => Tower [3] => 17-1 [4] => 65-60-75-60-50 [5] => 10-15-20-25-30-35-40-45-50-55 [6] => 0:20-0:30-0:50-1:35-2:00-2:55-3:45-4:25-5:05-6:0 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => The tower is an offensive structure. It boosts the offensive capabilities of the town in case of attack. [9] => 0 ) [15] => Array ( [0] => 15 [1] => 1 [2] => Barracks [3] => 16-1/17-1/21-1 [4] => 70-65-80-60-55 [5] => 100-90-85-80-75-70-65-60-55-50 [6] => 0:20-0:30-0:50-1:35-2:00-2:55-3:45-4:25-5:05-6:0 [7] => 3-1-1-2-3-2-3-3-4-4 [8] => At the barracks troops can be trained. The higher the level the faster the troops are trained. [9] => 0 ) [16] => Array ( [0] => 16 [1] => 1 [2] => Academy [3] => 21-1 [4] => 400-300-400-300-250 [5] => [6] => 1:0-1:0-1:0-1:0-1:0-1:0-1:0-1:0-1:0-1:0 [7] => 10 [8] => At the academy you can upgrade the maximum hit points of your army. [9] => 0 ) [17] => Array ( [0] => 17 [1] => 1 [2] => Blacksmith [3] => 16-1/21-1 [4] => 250-350-350-450-200 [5] => [6] => 0:45-0:45-0:45-0:45-0:45-0:45-0:45-0:45-0:45-0:45 [7] => 7 [8] => At the blacksmith you can upgrade the weapons & armor of your units. [9] => 0 ) [18] => Array ( [0] => 18 [1] => 1 [2] => Weapon and armor shop [3] => 16-1/21-1 [4] => 55-65-65-75-50 [5] => 100-90-85-80-75-70-65-60-55-50 [6] => 0:5-0:10-0:17-0:27-0:39-0:50-1:15-1:45-2:20-3:0 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => Here you can create weapons needed for your troops. The higher the level the faster the weapons are forged. [9] => 0 ) [19] => Array ( [0] => 19 [1] => 1 [2] => Stable [3] => 15-5/16-1/21-1 [4] => 80-60-55-60-55 [5] => 100-90-85-80-75-70-65-60-55-50 [6] => 0:10-0:20-0:40-0:55-1:20-1:55-2:45-3:25-4:05-5:0 [7] => 3-1-2-2-3-3-3-3-5-5 [8] => At the stable you can breed horses needed for your mounted troops. The higher the level the faster the horses are bred. [9] => 0 ) [20] => Array ( [0] => 20 [1] => 1 [2] => Siege shop [3] => 15-10/16-1/17-1/21-1 [4] => 70-65-80-60-55 [5] => 100-90-85-80-75-70-65-60-55-50 [6] => 0:20-0:30-0:50-1:35-2:00-2:55-3:45-4:25-5:05-6:0 [7] => 2-1-1-1-2-2-2-3-3-3 [8] => At the siege shop you can build siege weapons. The higher the level the faster the siege weapons are done. [9] => 0 ) [21] => Array ( [0] => 21 [1] => 1 [2] => Military storage [3] => [4] => 55-65-65-75-50 [5] => 5-10-20-30-45-70-90-100-150-250 [6] => 0:10-0:20-0:40-0:55-1:20-1:55-2:45-3:25-4:05-5:0 [7] => 2-1-1-1-2-2-2-2-2-2 [8] => Here weapons are stored. [9] => 0 ) )
wookieb
To teraz w swojej funkcji pobierajacej liste budynkow szukasz zapytania. I dodaj w tym zapytaniu kolumnę image.
corey
w php my admin dodałem tabelke image ALTER TABLE `buildings` ADD `image` varchar(120) DEFAULT NULL
wookieb
A czy ja napisałem, że masz coś robic w phpmyadmin?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.