Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: stupid gravity won't work right.. *FIX'D*  (Read 739 times)

0 Members and 1 Guest are viewing this topic.
stupid gravity won't work right.. *FIX'D*
« on: August 22, 2007, 11:35:07 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
EDIT: Fixed it..

If you've played my game's demo, you've seen my gravity magic engine.  I've made some changes to it and they aren't working so well. 
Basically i've got a boulder...it starts to accelerate towards the gravity source (good), it shoots past it and decelerates (good), then starts accelerating towards it again (good) at which point the gravity source is destroyed (good)...but the rock continues to accelerate and doesn't slow down (baaad)

objboulder

Alarm0
Code: [Select]
if speed >=0 && !instance_exists(objgrav) {
speed -=grassaccel/1.3
alarm[0] = 30
}

alarm1
Code: [Select]
alarm[1] = 1

if (global.forcepresent = false and speed !=0){
speed -=((grav - objboulder.accel)/1.3)/30
}

objgrav
create
Code: [Select]
alarm[0] = 1 //30 frames per second, start acceleration
alarm[1] = 60//destroy self
global.forcepresent = true

alarm0
Code: [Select]
objboulder.speed += ((grav - objboulder.grassaccel)/1.3)/30
alarm[0] = 1
movetowardspoint ->objboulder towards objgrav.x, objgrav.y, objboulder.speed

alarm1
Code: [Select]
global.forcepresent = falsedestroy

wtf ZFGC?
« Last Edit: August 23, 2007, 03:00:31 pm by MG-Zero »
Logged



i love big weenies and i cannot lie
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.086 seconds with 39 queries.

anything