Jump to content


Vaelix

Member Since 02 Feb 2011
Offline Last Active Apr 01 2011 04:08 PM

Topics I've Started

"Swap/Switch" HP Variable with another..

23 March 2011 - 10:18 PM

Like all of my questions this one is potentially highly "Novice" Thus I thank you in advance...

Alright..

Heres what I am looking for..

I'm trying to swap "global.playerHp" for "deepFreezeHp", when the spell Deep Freeze is in effect.

Basically what I want "Deep Freeze" to do, is to act as a "Defence" that replaces the players HP for a "Shield HP" called 'Deep Freeze', which would take, lets say 3 HP hits before it fades and returns the player to normal HP variable.

I also need a way to take the remainder of a hit, Lets say you take a 4 Damage with Deep Freeze in effect (Which would absorb 3 with its pseudo HP) then cause 1 Damage to the player.

Any and all advice is greatly appreciated, as I honestly havent a clue (Hopefully its not something very obvious)

~Vae

Freezing/Sleeping an Alarm

12 February 2011 - 10:12 AM

Alright, I've got an alarm set up that Im using as a form of "Mana Regeneration", basically every few seconds the player regenerates 1 mana..

alarm[0]=60

if (global.playerMana < global.maxMana)
      {
      global.playerMana += 1;
      alarm[0] = 60;
      }

      else
      {
      alarm[0] = 60;
      }
   }
    

Now as I said, what I need is a way to "Freeze" or "Sleep" the alarm when the player is hit with the spell "Mind Freeze".

What I want Mind Freeze to do is basically freeze Mana regeneration for X seconds (Stopping the alarm for a bit basically) then resume mana regen after the effect wears off (I assume Mind Freeze needs to be on its own alarm as well to do so)

Alright.. What im wondering here is, Should I define some "Effect" as "MindFreeze" then check if the effect is "True" on the target? (And if so, does MindFreeze need to be its own separate script to do so?)

or...??

if (MindFreeze = true)
    { // Code for Stopping the Alarm
    }
     
    else
    {
    }


If however, I am totally off base with everything in this post, please let me know, cause honestly Im just "pulling things out of a hat" in an attempt to guess correctly and have a properly working Mana Regen / Mana Regen Freeze.

~ Vae

*Stupidity* (Ignore)

05 February 2011 - 12:39 PM

Realized the stupidity.. trying to delete post now.

Sprite Movement

03 February 2011 - 11:01 PM

if (keyboard_check(global.DownKey))
 {
    if (sprite_index = sStormMage)
    {
    y += 2;
    sprite_index = sStormMageWalk;
    image_speed = .2;
    }
    else if (sprite_index = sRevStormMage)
    {
    y += 2;
    sprite_index = sRevStormMageWalk;
    image_speed = .2;
 }

This is one of my Movement keys, Im trying to write it so based on the previous sprite of the character, the game would display the correctly facing movement sprite.

With this code however, the sprite will only move a fraction downwards for each individual key press and will not move continually if the key is held down.

Now I know this is most likely wrong due to me now knowing the proper way of doing this, however, i have two questions..

First, based on this code, how is, what is happening, happening?

And, What would be the proper way of doing this? (Scrap what I have if completely wrong)

~Vae

Keyboard_check and &&

02 February 2011 - 09:07 AM


   
 if (keyboard_check(ord("D")))
 {    
 x += 2;
 sprite_index = sStormMageWalk;
 image_speed = .2;
 }

 if (keyboard_check(ord("A")))
 {
 x -= 2;
 sprite_index = sRevStormMageWalk;
 image_speed = .2;
 }

 if (keyboard_check(ord("S")))
 {
 y += 2;
 sprite_index = sRevStormMageWalk;
 image_speed = .2;
 }
 
 if (keyboard_check(ord("W")))
 {
 y -= 2;
 sprite_index = sStormMageWalk;
 image_speed = .2;
 }


 
 
 
 
 if (keyboard_check(ord('X')))                     
{                                                     
   
   if (firingDelay > 0)
   {
     firingDelay -= 1;
     }
   
   
   else if (sprite_index = sStormMage)               
    {                                        
     sprite_index = sStormMageCast
     instance_create(x, y, oLightningBolt)
     firingDelay = firingDelayMax;
    } 
     
    else if (sprite_index = sRevStormMage)
    {
    sprite_index = sRevStormMageCast         
    instance_create(x, y, oRevLightningBolt)
    firingDelay = firingDelayMax;
    }
    
    else if (sprite_index = sStormMageCast)
    {
     instance_create(x, y, oLightningBolt)
     firingDelay = firingDelayMax;
    }
    
    else if sprite_index = (sRevStormMageCast)
    {
     instance_create(x, y, oRevLightningBolt)
     firingDelay = firingDelayMax;
     }
}

 else
 {
   firingDelay = 0;
 }

Alright that is the jist of the code I am working with.. (Please Excuse Errors due to "Newbieness")

Pretty much the complication I am having (Due to not knowing the proper code for what im looking for) stems from my "X" keyboard check.

What I want to do is "if (keyboard_check(ord('X'))) && keyboard_check(ord('D')))" (D, W, A, S) so when the player is using one of the movement keys, they can press X (While holding a Movement Key) And still fire the weapon.

What currently happens is the Movement keys override the X && binds.

What is the proper code to be used in this situation?

Thanks in advance..

~Vae