Jump to content


lego_sniper

Member Since 24 Jul 2006
Offline Last Active Sep 27 2012 02:22 PM

Topics I've Started

Code Wrong?

06 February 2008 - 07:21 PM

Can anybody help me with this code. It wont allow the character to move up the slope.

Keyboard Right
if move==true && adrenaline==false && jumping==false
{if place_free(x+2,y)
{hspeed=4;sprite_index=player_run_r;forward=true;}
else
{y-=4;x+=2;}}

Step Event
if keyboard_check(vk_right){if place_meeting(x+1,y,obj_slope_r)
{if place_free(x+1,y-1){y-=4;x+=1;hspeed=0;vspeed=0;}}}
if place_meeting(x,y+1,obj_slope_r){move_snap(1,1)} else {move_snap(4,1)}

All help is appreciated.

Saving Enemies

15 January 2008 - 06:43 PM

I was just trying to prgram this but failed. So I was wondering, with INI files, how would you program saving the x and y of all the enemies in the level?

Making Code Smaller

26 December 2007 - 05:09 PM

How can I make this code smaller so it doesnt take as much room whilst still keeping the same actions?
//level 1
if keya==4 && shoot==0 && forward==false && levela==1 && global.mp>=5
{instance_create(player.x,player.y+38,sound_waves){shoot=1{alarm[0]=30}}global.mp-=5}

if keya==4 && shoot==0 && forward==true && levela==1 && global.mp>=5
{instance_create(player.x+35,player.y+18,sound_waves){shoot=1{alarm[0]=30}}global.mp-=5}

//level 2
if keya==4 && shoot==0 && forward==false && levela==2 && global.mp>=7
{instance_create(player.x,player.y+38,sound_waves){shoot=1{alarm[0]=30}}global.mp-=7}

if keya==4 && shoot==0 && forward==true && levela==2 && global.mp>=7
{instance_create(player.x+35,player.y+18,sound_waves){shoot=1{alarm[0]=30}}global.mp-=7}

//level 3
if keya==4 && shoot==0 && forward==false && levela==3 && global.mp>=10
{instance_create(player.x,player.y+38,sound_waves){shoot=1{alarm[0]=30}}global.mp-=10}

if keya==4 && shoot==0 && forward==true && levela==3 && global.mp>=10
{instance_create(player.x+35,player.y+18,sound_waves){shoot=1{alarm[0]=30}}global.mp-=10}

Renaming

22 December 2007 - 06:22 PM

Is there a function or something that when you type a variable name in, and then another one in, it switches the two?
For example: If I type in 'lives' then 'player_health' I change the 'lives' variable name to 'player_health'.

What's Wrong With This Code?

28 October 2007 - 08:00 PM

I have this in my obj(a_hit) step event:
if player.forward=true
self.y=sound_waves.y+12
self.x=sound_waves.x-10
if player.forward=false
self.y=sound_waves.y-30
self.x=sound_waves.x-20
But every time the sound waves or the a_hit object collides with something, this error comes up:
___________________________________________
ERROR in
action number 1
of  Step Event
for object a_hit:

Error in code at line 3:
   self.x=sound_waves.x-10

at position 21: Unknown variable x
That or something to do with the y.
Can you see the problem?