Messages - RedPillow [ switch to compact view ]

Pages: prev1 2 [3] 4 5 6 7 8 ... 28next
11
Developer's Corner / Re: [PHP] 'Dynamic variable name' ?
« on: February 05, 2011, 05:00 PM »
Thanks!
It's working now as so:
(Btw, any 'better' way to thank like reputation + etc. ?)
Code: PHP [Select]
  1. $i = 0;
  2.         $openMap = fopen("map/map_1-1.txt", "r");
  3.                 while (!feof($openMap)) {
  4.                         $line = fgets($openMap);
  5.                         $map[$i] = str_split($line);
  6.                         $i++;
  7.                 }
  8. fclose($openMap);
  9.  
  10. for ($row = 0; $row <= 13; $row++)
  11. {
  12.     for ($col = 0; $col <= 13; $col++)
  13.     {
  14.                 if ($map[$row][$col] == 'X') {
  15.                         echo "<img src = 'img/wall/X.jpg'/>";}
  16.                 elseif ($map[$row][$col] == 'G') {
  17.                         echo "<img src = 'img/terrain/G.jpg'/>";}
  18.     }
  19. }

12
Developer's Corner / Re: [PHP] 'Dynamin variable name' ?
« on: February 05, 2011, 04:17 PM »
What do you mean?
Aren't I using arrays when splitting the lines to an array?

13
Developer's Corner / Re: [PHP] 'Dynamin variable name' ?
« on: February 05, 2011, 04:10 PM »
Whaat?

I want to get every line of the text-file.
Then spilt those lines to arrays called map1, map2, map3 ... where each character of the line is one cell of an array.
But how do I name the $map differently after every loop?

like $map$i or somrthing?

14
Developer's Corner / [PHP] 'Dynamic variable name' ?
« on: February 05, 2011, 03:53 PM »
This is something I've managed to do so far:
Code: PHP [Select]
  1. function generateMap {
  2.         $i = 0;
  3.                 $openMap = fopen("map/map_1-1.txt", "r");
  4.                         while (!feof($openMap)) {
  5.                                 $line = fgets($openMap, 1024);
  6.                                         $map = str_split($line);

The problem is, that I want to name the array $map like $map$i  or $map + $i...
So that it's like $map1 = blah, $map2 = blah, $map3 = blah ...

Do you get me?
How do I do that?

15
Oh ... I also have background-music playing from the start ... I'd like it to stop when I say so.

Tried this one:

Code: ActionScript [Select]
  1. var bgMusic:bgMsc= new bgMsc();
  2. bgMusic.stop();

Also this:

Code: ActionScript [Select]
  1. var bgMusic:bgMsc= new bgMsc();
  2. bgMsc.stop();

Error is this:

TypeError: Error #1006: stop is not a function.
   at Untitled_fla::MainTimeline/frame96()


Isn't this similar (this is playsound-function when someone click the twitter-button)?:

Code: ActionScript [Select]
  1. function sound_play (e:MouseEvent):void {
  2. snd.play();
  3. }


Pages: prev1 2 [3] 4 5 6 7 8 ... 28next
Go to full version