I am a complete novice with virtually no programming experience whatsoever on the 3rd year of a game design course (they won’t teach basic skills but demand complicated artifacts for certain modules), currently I am working on a project for an experimental games module. The main push of the project is to create an RPG using a Bamboo Wacom tablet as the only game controller.
I realise this is far too advanced for me but the university doesn’t exactly care about that, the modules have been set and they won’t change regardless of how retardedly unrealistic they are.
The basics of what I need is a script that detects the presence of the pen as well as it’s location on the pad
I need a square area around the center of the pad to be set for idle animation and no motion
and 3 subsequent areas set to different move speeds and attatched animations.
the areas directly left and right of the neutral center area should be reserved for rotation only and areas either side of the forward backward move areas on the pad should have and incrementally increasing rotation speed.
The when the primary pen button is to be combined with gestures and pressure inputs to initiate attacks (the pressure is going to be a damage modifier alongside base weapon damage and character strength)
2 horizontal gesstures and 2 vertical gestures need to be detected but shouldn’t be tied to a specific location on the pad.
also a rough circular gesture needs to be accounted for.
The character name in the hierarchy is buddy
the animations are already done and tagged as follows:
idle1
walk1
jog1
run1
SwingLR1
SwingRL1
SwingOH1
SwingUp1
Swing3601
Potion
if anyone can help it would be appreciated, no amount of googling or pleading with the Wacom support people seems to have gotten me anywhere
i don’t know if you can access wacom input directly, but if you knew that you’ll have only 1 screen, your pen’s position on the pad would direclty relate to the mouse position on the screen.
if, however, the game is supposed to be running on every system, you would have to make a “calibration-scene” where you tell the user to put the pen into each of the 4 corners of the pad, so that you can approximate the pen’s position according to the mouse position.
this might not be the best solution out there but maybe it gets you started
kind of figured that simulating mouse-like behaviour might be simpler for some functions but i’m no coder, i’m, at best, a designer and animator, all i’m good for is assets and ideas so i still can’t really work from this. any coding examples would be handy
i threw something together here, might not be a very elegant solution but i tried to keep things as simple as possible.
right now this works with only 1 screen, i’d suggest playing fullscreen, because otherwise you are gonna be clicking everywhere. i’ve implemented the simple gestures too (up, down, left, right) but no circular gesture yet.
this is just a very rough structure of how it could work, but if works for you so far, i’m sure we can work on the little extra details that you are looking for.
private var xSector : int;
private var ySector : int;
private var sectorVector : Vector2;
private var customWidth : int;
private var customHeight : int;
private var mPos : Vector2;
function Start() {
customHeight = Screen.currentResolution.height;
customWidth = Screen.currentResolution.width;
}
function Update() {
//disable movement input while doing any gestures
if(!Input.GetMouseButton(0))
{
//i divided the screen into 3 zones on each axis, this can be changed to whatever you need
if(Input.mousePosition.x <= customWidth*0.4)
{
//left side
xSector = 1;
}
else if(Input.mousePosition.x <= customWidth*0.6 Input.mousePosition.x >= customWidth*0.4)
{
//mouse is centered on the x-axis
xSector = 2;
}
else
{
//right side
xSector = 3;
}
if(Input.mousePosition.y <= customHeight*0.4)
{
//mouse is below the center
ySector = 1;
}
else if(Input.mousePosition.y <= customHeight*0.6 Input.mousePosition.y >= customHeight*0.4)
{
//mouse is centered on the y-axis
ySector = 2;
}
else
{
//mouse is above the center
ySector = 3;
}
sectorVector = new Vector2(xSector, ySector);
//these are the sections where you will want to trigger your different animations
if(sectorVector == Vector2(1,1))
{
//bottom left
}
else if(sectorVector == Vector2(2,1))
{
//bottom center
}
else if(sectorVector == Vector2(3,1))
{
//bottom right
}
else if(sectorVector == Vector2(1,2))
{
//left of the center
}
else if(sectorVector == Vector2(2,2))
{
//center
}
else if(sectorVector == Vector2(3,2))
{
//right of the center
}
else if(sectorVector == Vector2(1,3))
{
//upper left
}
else if(sectorVector == Vector2(2,3))
{
//upper center
}
else if(sectorVector == Vector2(3,3))
{
//upper right
}
}
if(Input.GetMouseButtonDown(0))
{
//save mouse position for gestures
mPos = Input.mousePosition;
}
if(Input.GetMouseButtonUp(0))
{
if(Mathf.Abs(Input.mousePosition.x - mPos.x) < 10)
{
//didn't move on the x-axis
if(Input.mousePosition.y - mPos.y > 10)
{
//mouse moved up
}
else if(Input.mousePosition.y - mPos.y < -10)
{
//mouse moved down
}
else
{
//didn't move at all
}
}
else
{
if(Mathf.Abs(Input.mousePosition.y - mPos.y) < 10)
{
if(Input.mousePosition.x - mPos.x > 10)
{
//mouse moved right
}
else
{
//mouse moved left
}
}
else
{
//diagonal gesture - not implemented
}
}
}
}
thanks, I’ll tinker with that and see what i can make it do.