plants vs zombies
by hamed · in Technical Issues · 01/06/2012 (4:21 am) · 3 replies
hi im new in game making and i wanna start with tgb and i want to know that would i make a game such as plants vs zombies with this engine, is there mouse function for dragging and droping objects in this engine ?
About the author
the great costly games, but the only purpose is killing, and the only amuse but why we just should kill to be satisfied,why the games should not change ? great drama in the games ? maybe today , is the time to change from bullets to flowers
#2
yes i wanted grid lines for dropping object in special places,\and another crazy question, i have heared somewhere that tgb is full of bug and never make a game with that engine,and however unity is harder to learn but its very very better one.he said to me
is it true ?
01/06/2012 (8:05 pm)
truely i havent started yet and havent got information about the behaviours i just wanted to know may i do that or not ?yes i wanted grid lines for dropping object in special places,\and another crazy question, i have heared somewhere that tgb is full of bug and never make a game with that engine,and however unity is harder to learn but its very very better one.he said to me
is it true ?
#3
01/06/2012 (10:10 pm)
Quote:is it true ?No, it's not. All software contains bugs, even Unity. There are MANY amazing games made with Torque. If you want to make a 2D game and have access to high quality tools, Torque 2D is a great pick. You should try the demo and see how you like the editors and scripting.
Employee Michael Perry
ZombieShortbus
if (!isObject(MouseDraggableBehavior)) { %template = new BehaviorTemplate(MouseDraggableBehavior); %template.friendlyName = "Mouse Draggable"; %template.behaviorType = "Input"; %template.description = "Make an object draggable by the mouse"; %template.addBehaviorField(centerOnMouse, "Center the object on the mouse", bool, false); %template.addBehaviorField(toggleDragState, "Start dragging on one click, stop dragging on the next click", bool, false); } function MouseDraggableBehavior::onBehaviorAdd(%this) { %this.dragging = false; %this.cancelOnMouseUp = true; %this.offset = "0 0"; %this.owner.setUseMouseEvents(true); } function MouseDraggableBehavior::onMouseDown(%this, %modifier, %worldPos) { // Toggle the drag status. %this.dragging = !%this.dragging; // We always stop dragging on mouse up unless the toggle option is set. %this.cancelOnMouseUp = !%this.toggleDragState; // Schedule this or else we'll get two onMouseDowns. One for the locked // objects, and again for the not locked objects. %this.owner.schedule(0, setMouseLocked, %this.dragging); if (!%this.centerOnMouse) %this.offset = t2dVectorSub(%this.owner.position, %worldPos); } function MouseDraggableBehavior::onMouseUp(%this, %modifier, %worldPos) { if (%this.cancelOnMouseUp) { %this.dragging = false; %this.owner.setMouseLocked(false); } } function MouseDraggableBehavior::onMouseDragged(%this, %modifier, %worldPos) { if (%this.dragging) { %this.moveToMouse(%worldPos); // Once we have dragged, then dragging will always stop on mouse up. %this.cancelOnMouseUp = true; } } function MouseDraggableBehavior::onMouseMove(%this, %modifier, %worldPos) { if (%this.dragging) %this.moveToMouse(%worldPos); } function MouseDraggableBehavior::moveToMouse(%this, %worldPos) { %this.owner.position = t2dVectorAdd(%worldPos, %this.offset); }That allows for completely free movement, but it sounds like you will want to use a grid and allow snapping. Is that the case?