Jump to content

Recommended Posts

In my game I want it a user to be able to mine for ore...but I have no idea how to make a random map image (with walls and such) AND have ore hidden in random places...which are only revieled when you own the compass and you can only see the map when you own the map...but it still needs to know whether you can move North, South, East, West etc...

 

an example image of a random map might be something like:

pit.JPG

 

the dark green is walls, the black is where you can walk and the blue is where you can mine. Can this all be done in PHP???

 

ps also there would be another square colour which would be the users position....

Link to comment
https://forums.phpfreaks.com/topic/69367-solved-odd-question/
Share on other sites

hmmm....GD is confusing....

 

#!/bin/sh
echo "
  There is no \"configure\" script in this distribution of
  libpng-1.2.20.

  Instead, please copy the appropriate makefile for your system from the
  \"scripts\" directory.  Read the INSTALL file for more details.

  Update, July 2004: you can get a \"configure\" based distribution
  from the libpng distribution sites.  Download the file
  libpng-1.2.20.tar.gz or libpng-1.2.20.tar.bz2
"

 

it says that when trying to run configure....I hae no idea what to do?!?! can anyone point me in the right direction???

Link to comment
https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348539
Share on other sites

What's your server (is it own or a host?)

If own then this should be of help:

http://www.libgd.org/FAQ_PHP#How_do_I_get_gd_to_work_with_PHP.3F

 

And you'll probably not need to dl and compile yourself:

From 4.3.x, PHP includes its own version of gd, bundled in each PHP release.
Link to comment
https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348568
Share on other sites

GD is installed :)

 

gd

GD Support enabled

GD Version bundled (2.0.28 compatible)

FreeType Support enabled

FreeType Linkage with freetype

GIF Read Support enabled

GIF Create Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

XBM Support enabled

Link to comment
https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348577
Share on other sites

Here's a quikie...

<?php

header("Content-type: image/png");

$w = 230;
$h = 45;
$im = ImageCreate($w, $h);

$white = ImageColorAllocate($im, 255,255,255);
$black = ImageColorAllocate($im, 200, 100, 100);
$red = ImageColorAllocate($im, 255, 50, 50);
$green = ImageColorAllocate($im, 50, 255, 50);
$blue = ImageColorAllocate($im, 50, 50, 255);

//	DRAW BACKGROUND
ImageFilledRectangle($im, 0, 0, $w, $h, $red);
ImageFilledRectangle($im, 10, 10, 25, 25, $blue);

# Output the image to the browser
ImagePng($im);


?>

Link to comment
https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348588
Share on other sites

Thought I might now do a quick tut for my site so here's most basic draw functions and output formats...

<?php

header("Content-type: image/png");

$w = 230;
$h = 45;
//$im = ImageCreate($w, $h);
$im = imagecreatetruecolor($w, $h);

$white = ImageColorAllocate($im, 255,255,255);
$black = ImageColorAllocate($im, 200, 100, 100);
$red = ImageColorAllocate($im, 255, 50, 50);
$green = ImageColorAllocate($im, 50, 255, 50);
$blue = ImageColorAllocate($im, 50, 50, 255);

//	DRAW BACKGROUND
ImageFilledRectangle($im, 0, 0, $w, $h, $red);
ImageFilledRectangle($im, 10, 10, 25, 25, $blue);

# Output the image to the browser
ImagePng($im);
//imagejpeg($im);
//imagewbmp($im);
//imagexbm($im);

/*
bool imagearc ( resource $image, int $cx, int $cy, int $width, int $height, int $start, int $end, int $color )
bool imageellipse ( resource $image, int $cx, int $cy, int $width, int $height, int $color )
bool imagefill ( resource $image, int $x, int $y, int $color )
bool imagefilledarc ( resource $image, int $cx, int $cy, int $width, int $height, int $start, int $end, int $color, int $style )
bool imagefilledellipse ( resource $image, int $cx, int $cy, int $width, int $height, int $color )
bool imagefilledpolygon ( resource $image, array $points, int $num_points, int $color )
bool imagefilledrectangle ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color )
bool imagefilltoborder ( resource $image, int $x, int $y, int $border, int $color )
bool imageline ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color )
bool imagepolygon ( resource $image, array $points, int $num_points, int $color )
bool imagerectangle ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color )
bool imagesetpixel ( resource $image, int $x, int $y, int $color )
*/
?>

Link to comment
https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348602
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.