Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411580 Posts in 69386 Topics- by 58445 Members - Latest Member: Mansreign

May 05, 2024, 05:23:26 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Need movement code for my dragon
Pages: [1]
Print
Author Topic: Need movement code for my dragon  (Read 861 times)
mazimadu
Level 0
*



View Profile WWW
« on: July 03, 2010, 08:40:54 AM »

Hi guys. I need a little help with a game I am making. You see I am making a game where you have to fight a dragon by climbing to its head. So far I have the movement, attacks, and grapple code implemented; as seen below:


Right now the dragon is following the mouse. I am trying to make the dragon follow a predetermined path that changes based on the players location. Basically, I want the dragon to:
1. Move in a wavy motion left and right of the screen.
2. Slightly dive down to fire a fireball, then return to 1.
3. If the player is on it, move upwards and make a loop-de-loop.
4. If the player is really close to the head, avoid flying to 3 specific points on the screen.

All the while, speed is constant.

If you have Game maker 8(registered), you can try implementing your code with this stripped down version of the dragon.
http://www.box.net/shared/vs02xaz7im

If you can help out please reply this post. Smiley
« Last Edit: July 03, 2010, 08:49:20 AM by mazimadu » Logged

ink.inc
Guest
« Reply #1 on: July 03, 2010, 04:11:30 PM »

I assume that your dragon is divided up into pieces? If so, you can make them follow a simple sine pattern for the wavy action you described. Just put it in the step event for each piece.
//to move in a wave
y=sin(x/30)*16+ystart
//to move right
x+=2

Change the numbers as you wish.
It should work perfectly.
« Last Edit: July 03, 2010, 04:59:28 PM by ink.inc » Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic