Jump to content


Photo

Sprite trailing


  • Please log in to reply
4 replies to this topic

#1 Ginger_Overlord

Ginger_Overlord

    GMC Member

  • New Member
  • 3 posts
  • Version:Unknown

Posted 28 March 2016 - 07:30 PM

Hi,

 

I'm completely new to Games Maker and I have a small issue which I'm sure is easily rectified. Apologies if I have submitted this query in the wrong thread.

 

I've created a arrow sprite and I use code to enable me to move this around the screen using the arrow keys. The code rotates the sprite so that it faces and moves in accordance to what arrow key is pressed, really simple.

 

The thing is, the spite is creating a trail behind itself as if it's constantly printing itself on the screen. What's happening here?

Could someone help and explain what is happening and what I should do to rectify this.

 

Cheers,

 

Ginger_Overlord


  • 0

#2 nekuf

nekuf

    GMC Member

  • GMC Member
  • 378 posts
  • Version:GM:Studio

Posted 28 March 2016 - 07:36 PM

maybe your constantly creating it. show code.


  • 0

#3 Ginger_Overlord

Ginger_Overlord

    GMC Member

  • New Member
  • 3 posts
  • Version:Unknown

Posted 28 March 2016 - 08:14 PM

Hi nekuf,

 

Thanks for your reply.

 

Here is my code, please don't laugh :)

 

Information about object: obj_plyr

Sprite: spr_plyr_up
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set the friction to 0.1
Keyboard Event for <Left> Key:
execute code:

direction=180
sprite_index=spr_plyr_up
image_angle=90
speed=4
Keyboard Event for <Up> Key:
execute code:

direction=90
sprite_index=spr_plyr_up
image_angle=0
speed=4
Keyboard Event for <Right> Key:
execute code:

direction=0
sprite_index=spr_plyr_up
image_angle=-90
speed=4
Keyboard Event for <Down> Key:
execute code:

direction=-90
sprite_index=spr_plyr_up
image_angle=180
speed=4

  • 0

#4 TsukaYuriko

TsukaYuriko

    Remember... and never forget

  • Global Moderators
  • 9535 posts
  • Version:GM:Studio

Posted 28 March 2016 - 08:14 PM

Make sure that you're either drawing a background image or a colored background which always completely covers up the back buffer... otherwise you will directly draw to the back buffer, which is never automatically cleared. What you're currently experiencing sounds like this is what's going on.

 

 


This topic has been moved to the Q&A forum as it did not follow the guidelines of the original forum that it was posted in (or was not relevant to that forum).

NOTE: This is an automated reply!


  • 0

yBGBXQa.pngmWOQbeq.png


#5 Ginger_Overlord

Ginger_Overlord

    GMC Member

  • New Member
  • 3 posts
  • Version:Unknown

Posted 28 March 2016 - 08:51 PM

Hi Tsuka Yuriko,

Thanks for your reply.

 

Yes, that was it! I added a background, put this into my room and that resolved the problem - great work!

 

Regards,

 

Ginger_Overlord


Edited by Ginger_Overlord, 28 March 2016 - 08:52 PM.

  • 0