Topic:   Rotating Sprites   (Read 20036 times)


0 Members and 1 Guest are viewing this topic.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Rotating Sprites
« on: May 11, 2008, 11:21:25 AM »
I'm redoing trench warfare, but I need to know how to make a sprite point towards your mouse, not move but point. Like a guy aiming  his gun.
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Rotating Sprites
« Reply #1 on: May 11, 2008, 01:39:12 PM »
I don't think there is any code for that the most you could do is probably use a loop script and make it change sprites when your mouseX is high and low.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Rotating Sprites
« Reply #2 on: May 11, 2008, 04:16:55 PM »
That would take a LOOONG time, but I guess it's my only choice. :-[ :-/
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Rotating Sprites
« Reply #3 on: May 11, 2008, 04:28:50 PM »
Not really you just make three sprites and split the board into three sections 1 shooting slightly up,the other shooting strait, and the last shooting slightly down

« Last Edit: May 11, 2008, 04:29:28 PM by Tireas_Dragon »
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Rotating Sprites
« Reply #4 on: May 11, 2008, 04:31:08 PM »
It's actually incredibly easy. Here:

gunsprite$ = "Gun Pointing Forward"
IF MouseVert < 110 THEN gunsprite$ = "Gun Pointing Up"
IF MouseVert > 220 THEN gunsprite$ = "Gun Pointing Down"
SPRITE 1 50 165 $gunsprite$$

That on a repeat loop should work. ;)

EDIT:

Ah, TD has already beat me to the explanation. ;D
« Last Edit: May 11, 2008, 04:31:57 PM by Silverwind »
I survived the spammage of 2007

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Rotating Sprites
« Reply #5 on: May 11, 2008, 04:33:28 PM »
I may have beaten you to it but you wrote a sample.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Rotating Sprites
« Reply #6 on: May 11, 2008, 04:37:59 PM »
its easy, but you have to have seperate sprites for each movement, just have a up and down angle and a middle and put this code in the mousemove section

if mouseY > 200 then
recreatesprite
end if
if mouseY < 100 then
recreatesprite
end if
if mouseY < 200 then
if mouseY > 100 then
recreatesprite
end if
end if
« Last Edit: May 11, 2008, 04:38:24 PM by EqwanoX »

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Rotating Sprites
« Reply #7 on: May 11, 2008, 04:45:13 PM »
No mousemove section in GM Eq. ;) That would be pretty handy though... (nods knowledgeably at Al)
I survived the spammage of 2007

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Rotating Sprites
« Reply #8 on: May 18, 2008, 10:19:57 AM »
This is great guys, I'm working on it now.

EDIT: Wait, how do make a loop that lasts till the end of the card?
« Last Edit: May 18, 2008, 10:30:01 AM by Gnome_Again »
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Rotating Sprites
« Reply #9 on: May 18, 2008, 01:26:03 PM »
.....

..........

.................... what?

I don't understand. Click the Loop Script check box in the card script of a card, that will cause your code to loop endlessly. Is that not what you're trying to do?
I survived the spammage of 2007

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: Rotating Sprites
« Reply #10 on: May 19, 2008, 12:19:20 AM »
Quote
No mousemove section in GM Eq. ;) That would be pretty handy though... (nods knowledgeably at Al)

I just added ON MOUSEMOVE to my list of possible improvements. Thanks.