Help with mouse pointer problem - PIC & .ged included.

Game Editor comments and discussion.

Help with mouse pointer problem - PIC & .ged included.

Postby scythe » Thu Apr 19, 2007 2:52 pm

Here is an example of what id like to do

http://img111.imagevenue.com/img.php?im ... _529lo.jpg

I want the mouse pointer to act as the crosshair and to stay in the middle of screen but the rest of the background to move within the green area when mouse is moved. I then want to be able to click the mouse or press button when the 4 pixel red cursor is over the blue cans and destroy them when i do this. Ive wasted so much time trying to get this to work, can anyone help?



Thanks,
Scythe
Last edited by scythe on Sat Apr 21, 2007 8:27 am, edited 1 time in total.
scythe
 
Posts: 37
Joined: Wed Apr 11, 2007 2:50 pm
Location: Australia
Score: 0 Give a positive score

Postby pixelpoop » Thu Apr 19, 2007 6:20 pm

add an event to the view actor (the white bounding box)
(add-> create actor ->follow mouse)

parent the cross hairs actor to the view

add a new actor with a type of canvas

stretch the canvas to the size of the white box. (this is going to catch the mouse down button)

on the canvas actor go events add-> mousbuttondown ->script editor

create a new Global Integer Variable with the variable button (i called mine yourglobalvariablename)

in the scripting window type: yourglobalvariablename=1;

click add -> imediate action

now add a mouse up script editor event and type yourglobalvariablename=0;

on your actor to be shot go events -> add -> oncollision of crosshairs (change no to yes for repeat action) ->script editor and type this:

if (yourglobalvariablename==1)DestroyActor("Event Actor");

now test
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Sgt. Sparky » Fri Apr 20, 2007 9:28 pm

got to em' before I could. :(
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby scythe » Sat Apr 21, 2007 8:20 am

Thanks, i tried it, but am having the same problem as ive had a few times before, it seems to just scroll off the screen, here is my .ged file included.

I just want the dot to be able to kill the guy (testposer) i included in the .ged when i click on it, also i'd like to be able to do the same thing with keys, like make the dot kill the guy when button A is pressed for example.

Scythe
Attachments
ShootingGame.rar
(5.18 KiB) Downloaded 140 times
scythe
 
Posts: 37
Joined: Wed Apr 11, 2007 2:50 pm
Location: Australia
Score: 0 Give a positive score

Postby Sgt. Sparky » Sat Apr 21, 2007 4:44 pm

okay, I will work on it :)

but here is an example code,
first make a variable called slash,
on the key down event of A for your player,
Code: Select all
slash = 1;

on the key up event of A for your player,
Code: Select all
slash = 0;

now add this event for the you're player when it collides with the enemy,
Code: Select all
if(slash == 1)DestroyActor("Collide Actor");

do ya' get what I mean? :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby scythe » Tue Apr 24, 2007 4:27 pm

I tried it, but could not get it to work, so I started from scratch and did this...

Script / Global codes / Variables / Add
and created the variable Slash

Actor Control / Player / Key Down / A / Script editor
slash = 1;

At this point i get this error:

Error Line 1: Incompatible types: cannot convert from 'const int' to 'identifier' etc.

I didnt get this error the first time i tried, I must have stuffed up somewhere, sorry for being a lamer btw, but I am uber noob at any scripting/coding other than very basic html, so thanks for your help.

But i kinda understand what you mean and this has helped me learn a little along with the demo .geds.

scythe
scythe
 
Posts: 37
Joined: Wed Apr 11, 2007 2:50 pm
Location: Australia
Score: 0 Give a positive score

Postby Sgt. Sparky » Tue Apr 24, 2007 4:32 pm

okay,
if the variable is slash use slash = 1;
if it is Slash use Slash = 1;
you must match capitals exaclty :)
and when that key is pressed use,
Code: Select all
if(slash == 0)ChangeAnimation("Event Actor", "your_attack animation", FORWARD);

and when your attack animation finishes
Code: Select all
slash = 0;

:D
if you need more help let me know,
I used to be new at this to ya' know. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby scythe » Tue Apr 24, 2007 5:31 pm

Thanks for the help, cant believe I missed the case sensitive error hehe :)

Anyway sorry to bother you again but I still cannot get it working :( , could you possibly add that code to the demo .ged file i attached and up it, as it may be easier for me to work it out by examining the .ged file. The demo .ged file is basic, but should show you what i'm upto, well actually this sniper type game is what I hope to do after my first duck shooting gallery game attempt :)

Thanks again,
Scythe
Attachments
ShootingGameDemo-scythe.rar
(151.83 KiB) Downloaded 138 times
scythe
 
Posts: 37
Joined: Wed Apr 11, 2007 2:50 pm
Location: Australia
Score: 0 Give a positive score

Postby Sgt. Sparky » Tue Apr 24, 2007 5:35 pm

win rar is not installed... :(
could you make it a .zip? :)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby scythe » Tue Apr 24, 2007 6:08 pm

Sure no prob, just had to install it on my Vista partition, here is the .zip attached.

Thanks,
Scythe
Attachments
ShootingGameDemo-scythe.zip
(146.22 KiB) Downloaded 139 times
scythe
 
Posts: 37
Joined: Wed Apr 11, 2007 2:50 pm
Location: Australia
Score: 0 Give a positive score

Postby pixelpoop » Tue Apr 24, 2007 6:42 pm

list of problems:

on the "a" key up event you need to set Slash back to 0. You were setting it as 1.

I don't think your red dot ever touches the man because the sniperview actor is inbetween them.

Your collision statement is incomplete. you wrote: if(Slash==1);
it should read something like this:
if(Slash==1)DestroyActor("NME_Terrorist");

think of "if" statements as "if then" or "if then else"...
if (this is true){ then do this; and this;} else {do this if the statement is not true;}

you should also have the collision statement on the man. that way if you have clones of the same guy you won't kill them all with the same bullet.

Your fire button should not be set to repeat unless the gun shoots at 30 bullets per second

on the Draw Actor event for the red dot I included this code:
if (n==1) { n=0; Slash=0; }
if (Slash==1) n=1;

note: that code makes it so you can't press the fire button and then drag the view over the man. The kill only lasts 1 frame.

i have included these changes in this file.
Attachments
ShootingGameDemo-scythe.zip
updated
(161.25 KiB) Downloaded 122 times
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby scythe » Fri Apr 27, 2007 8:31 am

Thanks pixelpoop I'll make sure you and sgt sparky and other guys that help get a mention in the credits, if i ever get time to finish it :)

Yeah sorry about that, the code was messy as i was half assed editing it too see if i could find out what the problems were, and kinda left it half edited :)

I'll study your stuff and hopefully it will help me understand things a little more, I used to program a little basic on the c64 in the late 80's but seem to have forgotten everything like IF THEN etc. :)

I cant seem to get the player reddot to sway with the scope by using parent though, as it then effects the background, i'll look into it, but I probably was gonna scrap that part anyway as i couldnt get it to look quite right and don't need it for the Duck & Can shooting game.

BTW I can't seem to get on the forum sometimes, but can visit the GE main page, anyone else have that problem? must be getting busy i guess.

Thanks again guys,
scythe
scythe
 
Posts: 37
Joined: Wed Apr 11, 2007 2:50 pm
Location: Australia
Score: 0 Give a positive score

Postby Sgt. Sparky » Fri Apr 27, 2007 2:18 pm

scythe wrote:BTW I can't seem to get on the forum sometimes, but can visit the GE main page, anyone else have that problem? must be getting busy i guess.

yeah,
I could not get on the forum untill just a few minutes ago,
it would not even let me onto the GE main page.... :(
internet explorer cannot display the webpage....
worst message I got... :(
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Caaz Games » Fri Apr 27, 2007 2:51 pm

Sgt. Sparky wrote:
scythe wrote:BTW I can't seem to get on the forum sometimes, but can visit the GE main page, anyone else have that problem? must be getting busy i guess.

yeah,
I could not get on the forum untill just a few minutes ago,
it would not even let me onto the GE main page.... :(
internet explorer cannot display the webpage....
worst message I got... :(
Same for me except I'm using Firefox and it says it cannot connect.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby Sgt. Sparky » Fri Apr 27, 2007 6:09 pm

__CAAZ__'s signature wrote:I'm Going To Be On T.V.!

why? :|
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron