Topic:   Real time battle engine   (Read 24883 times)


0 Members and 1 Guest are viewing this topic.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Real time battle engine
« on: December 14, 2008, 12:00:34 PM »
I'm making a real time battle engine, basically you attack a guy by clicking "attack" then sprites will appear on the screen and you must click them before the timer runs out, or your attack ends. It mimics slashing.

Here is what I have so far


SPRITE 1 300 600 soldier1.gif
slashtimermax = 50
' the starting timer for the slash
slashtimer = slashtimermax
' the tmer
click = 0
' tells that the player is NOT slashing
timer = 0
'when button named attack is pushed the timer starts

IF timer = 1 THEN
 Â ON TIMER 1
 Â   IF click = 0 THEN
 Â     place = RANDOM 5
 Â   END IF
 Â   ' places where x can be
 Â   IF place = 1 THEN
 Â     SPRITE 2 230 520 x.gif
 Â     click = 1
 Â   END IF
 Â   IF place = 2 THEN
 Â     SPRITE 2 160 480 x.gif
 Â     click = 1
 Â   END IF
 Â   IF place = 3 THEN
 Â     SPRITE 2 170 500 x.gif
 Â     click = 1
 Â   END IF
 Â   IF place = 4 THEN
 Â     SPRITE 2 200 450 x.gif
 Â     click = 1
 Â   END IF
 Â   IF place = 5 THEN
 Â     SPRITE 2 310 620 x.gif
 Â     click = 1
 Â   END IF
 Â   slashtimer = slashtimer - 1
 Â   ' timer for slashing
 Â   IF slashtimer = 0 THEN
 Â     timer = 0
 Â     ' if timer runs out slashing ends
 Â   END IF
 Â   IF spriteclicked = 2 THEN
 Â     enemyHP = enemyHP - 10
 Â     click = 0
 Â     slashtimermax = slashtimermax - 5
 Â     slashtimer = slashtimermax
 Â     ' when you click the designated  x for the slash, the enemy is damaged, the max timer goes down, and timer
 Â     ' resets
 Â   END IF
 Â END TIMER
END IF


The sprites won;t show up, but that seems to be the only problem so far.
« Last Edit: December 14, 2008, 12:03:34 PM by Gnome_Again »
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Real time battle engine
« Reply #1 on: December 14, 2008, 02:00:36 PM »
So I think I understand it You first have a large window to attack the enemy but as you attack you have less and less time to click on the next sprite. Am I right?

Oh and the problem with you code

you have:

timer = 0
If timer = 1 THEN

Not much chance for timer to = 1 if you set it to 0 before it checks.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Real time battle engine
« Reply #2 on: December 14, 2008, 02:58:54 PM »
It waits to you click the "attack" button, then timer = 1
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Swamp7hing


  • GMG-er

  • **


  • Posts: 751

  • I come from the swamps.
Re: Real time battle engine
« Reply #3 on: December 14, 2008, 03:08:53 PM »
Cool, when can you post a demo?

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Real time battle engine
« Reply #4 on: December 14, 2008, 06:12:46 PM »
I working on it, but the sprites won't show up (always the sprites  ::) )


This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: Real time battle engine
« Reply #5 on: December 14, 2008, 06:18:20 PM »
You may have to change the timer variable to something else. Name it mytimer and see if that works.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Real time battle engine
« Reply #6 on: December 14, 2008, 06:21:53 PM »
it's not just that, even the first sprite soldier1.gif doesn't work ???


EDIT:

changed the file name, nothings happening, there seems to be no error.
« Last Edit: December 14, 2008, 06:24:59 PM by Gnome_Again »
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: Real time battle engine
« Reply #7 on: December 14, 2008, 07:01:05 PM »
Is it in a card script? Put REFRESH as the first line.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Real time battle engine
« Reply #8 on: December 14, 2008, 07:13:28 PM »
It just made the card load slower...  :(
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Real time battle engine
« Reply #9 on: December 14, 2008, 07:58:44 PM »
Here is the source if it helps.


http://www.mediafire.com/?gvz0myomgjz
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: Real time battle engine
« Reply #10 on: December 15, 2008, 07:51:28 AM »
Several problems.

1. The sprites don't show up because they were being drawn off screen. I reduced the X and Y coordinates.

2. Remove the TIMER stuff from the card script and put it in the Attack button.

Here is what I have so far:

Card Script:

SPRITE 1 300 100 soldier1.gif
slashtimermax = 50
' the starting timer for the slash
slashtimer = slashtimermax
' the tmer


Attack Button Script:

click = 0

ON TIMER 1
IF click = 0 THEN
place = RANDOM 5
END IF
' places where x can be
IF place = 1 THEN
SPRITE 2 230 120 x.gif
click = 1
END IF
IF place = 2 THEN
SPRITE 2 160 180 x.gif
click = 1
END IF
IF place = 3 THEN
SPRITE 2 170 200 x.gif
click = 1
END IF
IF place = 4 THEN
SPRITE 2 200 250 x.gif
click = 1
END IF
IF place = 5 THEN
SPRITE 2 310 220 x.gif
click = 1
END IF
slashtimer = slashtimer - 1
' timer for slashing
IF slashtimer = 0 THEN
TIMER OFF
' if timer runs out slashing ends
END IF
'setwindowtitle $spriteclicked$
IF spriteclicked = 2 THEN
spriteclicked = 0
beep
enemyHP = enemyHP - 10
click = 0
slashtimermax = slashtimermax - 5
slashtimer = slashtimermax
' when you click the designated  x for the slash, the enemy is damaged, the max timer goes down, and timer
' resets
SHOWBUTTON 5 $enemyHP$
END IF
END TIMER


Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Real time battle engine
« Reply #11 on: December 15, 2008, 10:40:02 AM »
I have also thought of a Code and it includes random locations for the  "X"

Here is the Code:


Attack Button
click = 0
slashtimermax = 100
mytimer = 1
hp = 100
enemyhp = 100

ON TIMER 5
  IF mytimer = 1 THEN
    IF click = 0 THEN
' places where x can be
      y = RANDOM 100 120 140 160 180 200 220 240 260
      x = RANDOM 380 400 420 440 460 480 500 520 540 560
      SPRITE 2 x y x.gif
      click = 1
    END IF
    slashtimer = slashtimer - 5
' timer for slashing
    IF slashtimer = 0 THEN
      SPRITE -2
      TIMER OFF
' if timer runs out slashing ends
    END IF
    IF spriteclicked = 2 THEN
      spriteclicked = 0
      Beep
'  Tireas Dragon: What I like Al's Idea of beep
      enemyHP = enemyHP - 10
      click = 0
      slashtimermax = slashtimermax - 5
      slashtimer = slashtimermax
' when you click the designated  x for the slash, the enemy is damaged, the max timer goes down, and timer
' resets
      END IF
  END IF
  IF enemyhp > 0 THEN SHOWBUTTON 3 EnemyHP: $enemyhp$
  IF enemyhp <= 0 THEN SHOWBUTTON 3 Enemy Dead
  SHOWBUTTON 1 Your Health: $hp$
END TIMER

Card Script
SPRITE 1 450 169 soldier1.gif
slashtimermax = 50
' the starting timer for the slash
slashtimer = slashtimermax
' the tmer
click = 0
' tells that the player is NOT slashing
mytimer = 0
'when button named attack is pushed the timer starts

I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: Real time battle engine
« Reply #12 on: December 15, 2008, 05:21:26 PM »
TD's script doesn't work for some reason.


The X's don't show up...
This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Real time battle engine
« Reply #13 on: December 15, 2008, 06:18:10 PM »
Hmm I am using a a beta for 3992 maybe there is a undiscovered glitch in 3991 that Al accidentally fixed.
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.