Hey Guys!
I find the browser based rts tutorial , and I started copy the code...
Well , I have problem with...
When I click to the "maparea" div not place the house/tower...
mainfunctions.js :
function init(){
Sp_linuxcompatible=true;
house=new SP_Sprite();
house.setImage("kepek/epitmenyek/house_3.png",100,83);
house.setXlimits(offsetmap, offsetmap +175);
house.setYlimits(110, 590);
house.setFrame(0);
house.switchOn();
house.setZ(8);
house.moveTo(0,0);
house.setAnimationSpeed(8,"forward");
buildGUI=new G1_layer(400,400,50,'');
buildGUI.setXlimits(0,1200);
buildGUI.setYlimits(0,600);
buildGUI.resizeTo(5,10);
buildGUI.setBackground("kepek/GUI/buildbar.png");
buildGUI.moveTo(-100,-100);
buildGUI.hide();
Gl_hook("game_loop()");
Gl_scrollbars("no");
themouse=Ms_initmouse();
Gl_start();
}
//main game loop//
function game_loop()
{
if(buildGUI.x > 1)
{
buildmeter();
}
}
function selectbuilding(building)
{
buildingselected = 1;
document.getElementById('selectedbuilding').innerHTML="<img src='kepek/epitmenyek/" + building + "_3.png'>"
}
function checkelement()
{
buildingselected = 0;
house.moveTo(themouse.x,themouse.y);
buildGUI.moveTo(house.x,house.y -10);
buildGUI.show();
document.getElementById('selectedbuilding').innerHTML ="";
}
function buildmeter()
{
if(counter1 > buildtime)
{
counter1 = 0;
buildmeter1 = buildmeter1 + 2;
buildGUI.resizeTo(buildmeter1,10);
}
counter1 = counter1 + 1;
if(buildmeter1 > 50)
{
buildGUI.moveTo(-100,-100);
buildGUI.hide();
house.setImage("kepek/epitmenyek/house_3.png",75,63);
house.setAnimationSpeed(0);
house.setFrame(0);
}
}
index.php
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="JavaScript" src="gamelib/gamelib_core1.js"></script>
<script type="text/javascript" language="JavaScript" src="gamelib/gamelib_sprites1.js"></script>
<script type="text/javascript" language="JavaScript" src="gamelib/gamelib_mouse1.js"></script>
<script type="text/javascript" language="JavaScript" src="mainfunctions.js"></script>
<script type="text/javascript">
var buildingselected = 0;
var buildmeter = 1;
var buildtime = 20;
var counter1 = 0;
var offsetmap = document.getElementById('maparea').offsetLeft;
// alert(offsetmap);
</script>
</head>
<div id="wrapper">
<body onLoad="if(!G1_browser.panic)init()" >
<div id="panelarea">
<?php include "panel.php"; ?>
</div>
<div id="maparea" onClick="checkelement();"></div>
<div id="rpanelarea" align="center">
<?php include "rpanel.php"; ?>
</div>
</body>
</html>
Help me browser based rts #2 , #3
Videos around the RTS tutorial series
Return to “Browser based RTS Videos”
Jump to
- General
- ↳ Announcements and Site Discussion
- ↳ News
- ↳ Say Hello
- ↳ Off-Topic
- ↳ Reviews
- ↳ Development Related
- ↳ Misc
- Developer's Corner
- ↳ General Development
- ↳ Game Design
- ↳ Resources
- ↳ Recruitment
- Game Development
- ↳ Beginner Help and Support
- ↳ Advanced Help and Support
- ↳ Programs/Assets/Libs/Open Source/Ect...
- ↳ Coding
- Show Off
- ↳ Project Showoff Tier I
- ↳ Project Showoff Tier II
- ↳ WebSite
- ↳ Art Showoff
- ↳ Members Games
- ↳ Main Empire Special
- ↳ General
- ↳ Development
- ↳ Off-Topic
- ↳ Bad Touch Studios
- ↳ Nitewing Gaming
- ↳ Fabled Kingdoms of Nizinia
- ↳ Announcements
- ↳ Development
- ↳ General
- ↳ Maze
- ↳ General
- ↳ Development
- ↳ Media
- ↳ Forsaken Sanctum 4.0
- ↳ General
- ↳ Contests
- ↳ Bugs and suggestions
- ↳ Forum Game
- ↳ Cavern Crawl
- ↳ Planetary Wars
- ↳ General
- ↳ Development
- Dot World Maker
- ↳ General
- ↳ Source Discussion
- New Worlds Engine
- ↳ General
- ↳ NWE Project Showoff
- KWM - Kal's world maker engine and NEAB
- ↳ Announcements
- ↳ KWM
- ↳ NEAB
- Tutorials
- ↳ Tutorials
- ↳ Epiales's Blender Tutorials
- ↳ Youtube Tutorials
- ↳ Browser Based MMO 2.0
- ↳ Real Time Browser Based MMO
- ↳ Older Browser MMO Videos
- ↳ Browser based RTS Videos
- ↳ C# Tutorials Videos
- ↳ Impact and Node/Socket.io
- ↳ Advanced MMO Framework
- ↳ Node For beginners
- ↳ Zester's Video Tutorials
- ↳ HallsNode
- ↳ Ticket System 2.0
- ↳ Code Sharing
- ↳ Hall's Games
- TMMOKit
- ↳ Help and Guides
- ↳ General
- Engine Discussion
- ↳ HTML5/Web Engines
- ↳ MMO Makers
- ↳ 3d Engines
- ↳ 2D engines
- ↳ Unity 3d
- ↳ General Unity
- ↳ Art and Assets
- ↳ Scripting/Coding
- Simple PBBG Engine
- ↳ Updates
- ↳ General
- Test