Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> Help needed: Monster Awards Points on View Exi
Unspecified
Jeffrey
Posted: May 19 2008, 08:00 AM
Quote Post


Standard Member


Group Icon
Group: Members
Posts: 24
Member No.: 1290
Joined: 24-July 05

Status: (0d) [--]


Alright, so I am making a fangame using Djrellik's SMB3 engine with GameMaker. I tried to recreate the arcade Mario Bros. game's Shellcreeper using the Spiny as a base, and it now works as it should.

However, in a level with views enabled, when it's out of sight, it gives 800 points (I set it to give that much) and disappears.

Here's the information on the object:

CODE
Sprite: shellcreeper
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: Monsterinvincible
Mask: <same as sprite>

Create Event:
execute code:

image_speed=0.1
myhealth=1
counter=0
if Mario.x<x mydirection="left"
else mydirection="right"
firehit=false
collision=false
myscore=800

Destroy Event:
execute code:

death=instance_create(x,y,Enemydeath)
death.sprite_index=spinyfire
if variable_local_exists("mydeath")
death.hspeed=mydeath
if variable_local_exists("myjumped")
death.vspeed=myjumped
getpoints(myscore)

Alarm Event for alarm 1:
execute code:

if place_meeting(x,y,Monsterjump)
{
enemy=instance_place(x,y,Monsterjump)
if enemy.object_index=Lakitu exit
if enemy.mydirection=mydirection
 {
  if mydirection="right" mydirection="left"
  else mydirection="right"
 }
alarm[1]=6
}
else if place_meeting(x,y,Koopashield)
{
enemy=instance_place(x,y,Koopashield)
if enemy.mydirection=mydirection
 {
  if mydirection="right" mydirection="left"
  else mydirection="right"
 }
alarm[1]=6
}
else if place_meeting(x,y,Spiny)
{
enemy=instance_place(x,y,Spiny)
if enemy.mydirection=mydirection
 {
  if mydirection="right" mydirection="left"
  else mydirection="right"
 }
alarm[1]=6
}
else collision=false

Alarm Event for alarm 6:
execute code:

counter=0

Alarm Event for alarm 7:
execute code:

visible=true

Step Event:
COMMENT: engine
execute code:

if place_free(x,y+1) and
(not position_meeting(x-sprite_xoffset+sprite_width/2,y-sprite_yoffset+sprite_height,Jumpthroughblock)
or not position_meeting(x-sprite_xoffset+sprite_width/2,y-sprite_yoffset+sprite_height,Solidblock2))
gravity=0.2
else
gravity=0
if vspeed>3 vspeed=3
if x<view_xview[0]-30
or x>view_xview[0]+370
or y>room_height[0]+30 instance_destroy()
if firehit=true instance_destroy()
if mydirection="right"
{
 if place_free(x+1,y)
  {
   x+=0.6
   sprite_index=shellcreeper_right
  }
 else mydirection="left"
}
else if mydirection="left"
{
 if place_free(x-1,y)
  {
   x-=0.6
   sprite_index=shellcreeper
  }
 else mydirection="right"
}
COMMENT: jumpthrough block
execute code:

if vspeed > 0 and position_meeting(x-sprite_xoffset+sprite_width/2,y-sprite_yoffset+sprite_height,Jumpthroughblock)
{
 platform=instance_place(x,y+vspeed+2,Jumpthroughblock)
 if platform=noone exit
 y=platform.y-sprite_height+1
 vspeed=0
}
else if vspeed > 0 and position_meeting(x-sprite_xoffset+sprite_width/2,y-sprite_yoffset+sprite_height,Solidblock2)
{
 platform=instance_place(x,y+vspeed+2,Solidblock2)
 if platform=noone exit
 y=platform.y-sprite_height+1
 vspeed=0
}


Collision Event with object Solidblock:
execute code:

 if (vspeed > 0 && not place_free(x,y+vspeed)) move_contact(270);
 vspeed = 0


Collision Event with object Blockerlr:
execute code:

if counter=0
{
if mydirection="right"
mydirection="left"
else mydirection="right"
counter=1
alarm[6]=2
}

Collision Event with object Monsterjump:
execute code:

if collision=true exit
collision=true
if mydirection="right" mydirection="left"
else mydirection="right"
alarm[1]=6

Collision Event with object Flipblock:
execute code:

if other.solid=true
{
 if (vspeed > 0 && not place_free(x,y+vspeed)) move_contact(270);
  vspeed = 0;
}


Collision Event with object Springr:
execute code:

if other.solid=true
{
 if (vspeed > 0 && not place_free(x,y+vspeed)) move_contact(270);
  vspeed = 0;
}


Collision Event with object Koopashield:
execute code:

if collision=true exit
collision=true
if mydirection="right" mydirection="left"
else mydirection="right"
alarm[1]=6

Collision Event with object Spiny:
execute code:

if collision=true exit
collision=true
if mydirection="right" mydirection="left"
else mydirection="right"
alarm[1]=6

Collision Event with object Solidblock2:
execute code:

if place_meeting(x,y+1,Solidblock) exit
if (vspeed > 0 && not place_free(x,y+vspeed)) move_contact(270);
 vspeed = 0


Collision Event with object Dudblockanim:
execute code:

vspeed=-3
change the instance into object shellcreeper_stunned, not performing events

Collision Event with object Brickanim:
execute code:

vspeed=-3
change the instance into object shellcreeper_stunned, not performing events


Sorry about the size!

Thanks in advance,
~Jeffrey

This post has been edited by Jeffrey on May 19 2008, 08:01 AM


--------------------
Come and support my fan game!
Mario Compilation Fan Game (Beta title)

~Jeff
PMEmail Poster
Top
Canada
MegaTailzChao
Posted: May 19 2008, 11:12 AM
Quote Post


So long, and thanks for all the fish.
[S][*][*][*][*]
[*][*]

Group Icon
Group: Site Staff
Posts: 15788
Member No.: 2267
Joined: 2-July 06

Status: (0d) [--]


CODE
Step event
f x<view_xview[0]-30
or x>view_xview[0]+370
or y>room_height[0]+30 instance_destroy()

problem goes here


--------------------
user posted image
user posted imageuser posted image
PMEmail PosterMSN
Top
Unspecified
Jeffrey
Posted: May 19 2008, 11:24 AM
Quote Post


Standard Member


Group Icon
Group: Members
Posts: 24
Member No.: 1290
Joined: 24-July 05

Status: (0d) [--]


Darn! I gotta stop falling for such simple tricks!

Anyways, thanks!

~Jeffrey


--------------------
Come and support my fan game!
Mario Compilation Fan Game (Beta title)

~Jeff
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0497 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 0.80 ]