Jump to content

Movement System with Sprites


MasterACE14

Recommended Posts

hello,

 

I am making a simple Movement(north,south,east,west) system and world generating system, using Sprites. Using Session Variables to hold the data. As the system will not be used for a game just yet. It will be later.

 

I haven't made the movement system yet, as I am working on the world generating part first.

 

here's what I have so far... It's dodgy, but it generates the world. I am open to suggestions.

note: it isn't complete.

<?php
session_start();

function block($look="grass",$type="none",$block=0,$x,$y) {
switch($look) {
	case "grass":
	 echo "<img src=\"sprites/terrain/grass.gif\" />";
	break;
}
switch($type) {
	case "none":
	 $type = "none";
	break;
}
switch($block) {
	case 1:

	break;
}
$x = $x;
$y = $y;
}

function map($blocks) {
echo $blocks;
}

$world = array();
$world[1] = block("grass","none",0,0,0);
$world[2] = block("grass","none",0,0,1);
$world[3] = block("grass","none",0,0,2);

?>
<html>
<head>
<title>Explore</title>
<style>
<!--
#map {
margin: 0 auto;
border: 1px solid black;
}
#compass {
margin: 0 auto;
border: 2px outset black;
}
-->
</style>
</head>
<body>

<div id="map">
<?php
map($world);
?>
</div>

</body>
</html>

 

I have made movement systems before, But I have never used sprites as well as movement and generating worlds/maps.

The movement isn't such a problem. Buts its the generating the world and working with the images that is.

 

any help or suggestions are greatly appreciated.

 

Regards ACE

Link to comment
https://forums.phpfreaks.com/topic/120674-movement-system-with-sprites/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.