#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Game Suggestion

edited January 2015 Posts: 2

I have recently working on this game called Dino Dash. In this game you play as a dinosaur who must eat everyone he sees. If you miss a person the game is over. What should I add? What should I change? Sorry about the sprites. I used custom sprites and so they do not line up right. Please leave a comment. Here is my code:

``````function setup()
b1x=-100 --x of first person
b1y=200 --y of first person

b2x=-100 --x of second person
b2y=150 --y of second person

b3x=-100 --x of third person
b3y=50 --y of third person

lx=-100
ly=150

l2x=-300
l2y=150

l3x=-500
l3y=150

l4x=-700
l4y=150

l5x=-900
l5y=150

l6x=-1100
l6y=150 --^^^^^^^ these are the variables for the road marks

score=0 --the score

t=0 --the speed of animation movement

x2=500 --tap to start text x
y2=500 --tap to start text y

rsx=-100 --x of rocket ship
rsy=100 --y of rocket ship
end
function draw()

r=math.random(-200, 200) --the random math for random people

sy=CurrentTouch.y - 100 --setting the dino head to touch position
sx=CurrentTouch.x - 100 --setting the dino head to touch position

iy=CurrentTouch.y - 100 --setting dino image
ix=CurrentTouch.x - 100 --setting dino image

background(0, 112, 255, 255) --background

sprite("Platformer Art:Block Brick", 500, 600, 1100, 600) --city background

fill(88, 88, 88, 255) --road color

fill(183, 210, 13, 255) --road mark color
lx=lx+t
rect(lx, ly, 70, 20)
if lx>WIDTH+70 then lx=-100
end

l2x=l2x+t
rect(l2x, l2y, 70, 20)
if l2x>WIDTH+70 then l2x=-100
end

l3x=l3x+t
rect(l3x, l3y, 70, 20)
if l3x>WIDTH+70 then l3x=-100
end

l4x=l4x+t
rect(l4x, l4y, 70, 20)
if l4x>WIDTH+70 then l4x=-100
end

l5x=l5x+t
rect(l5x, l5y, 70, 20)
if l5x>WIDTH+70 then l5x=-100
end

l6x=l6x+t
rect(l6x, l6y, 70, 20)
if l6x>WIDTH+70 then l6x=-100
end --^^^^^^ road mark animation and placemnt

b1x=b1x+t
sprite("Planet Cute:Character Boy",b1x, b1y, 70, 70) --person 1

b2x=b2x+t
sprite("Planet Cute:Character Princess Girl",b2x, b2y, 70, 70) --person 2

b3x=b3x+t
sprite("Planet Cute:Character Cat Girl",b3x, b3y, 60, 60) --person 3

sprite("Tyrian Remastered:Blimp Boss Destroyed", sx, sy, 100) --dino head

sprite("Tyrian Remastered:Brown Capsule 1", ix, iy, 100) --full dino

rsx=rsx+t
sprite("SpaceCute:Rocketship", rsx, rsy, 150)

fill(0, 0, 0, 255) --text color
fontSize(20) --score text size
text(score, 100, 700) --score placement
fontSize(100) --tap to start text size
text("Tap To Start", x2, y2) --tap to start text placement

if rsx>WIDTH+200 then rsx=-400 rsy=rsy+r --resetting the spaceship
end

if b1x ==1100 then t=0 b1x=-200 text(score, 500, 300) --if person 1 moves off screen then game over
end

if b2x ==1100 then t=0 b1x=-200 text(score, 500, 300) --if person 2 moves off screen then game over
end

if b3x ==1100 then t=0 b1x=-200 text(score, 500, 300) --if person 2 moves off screen then game over
end

if b1x==-200 then text("Game Over", 500, 500) --if person moves off screen then game over text
end

if b1y<20 or b1y>300 then b1y=300 --making sure person 1 doesnt move off the road.
end

if b2y<20 or b2y>300 then b2y=300 --making sure person 2 doesnt move off the road
end

if b3y<20 or b3y>300 then b3y=300 --making sure person 3 doesnt move off the road
end

if score>10 then t=6
end

if score>20 then t=7
end

if score>30 then t=8
end

if score>40 then t=9
end

if score>50 then t=10
end

collision()
end
function collision()

a=(sx-b1x-155)^2
b=(sy-b1y+90)^2
c=math.sqrt(a+b)
if c<40 then score=score+1 b1x=-100 b1y=b1y+r
sound("Game Sounds One:Pop 1") --collision for person 1
end

a=(sx-b2x-155)^2
b=(sy-b2y+90)^2
c=math.sqrt(a+b)
if c<40 then score=score+1 b2x=-100 b2y=b2y+r
sound("Game Sounds One:Pop 1") --collision for person 2
end

a=(sx-b3x-155)^2
b=(sy-b3y+90)^2
c=math.sqrt(a+b)
if c<40 then score=score+2 b3x=-100 b3y=b3y+r
sound("Game Sounds One:Pop 1") --collision for person 3
end

if CurrentTouch.state == BEGAN then t=5 x2=-1000 y2=-1000 --moves game over text off screen
end
end
``````
Tagged:

• edited January 2015 Posts: 8,491

@sawyer797 1.) When you post code, put 3 ~'s before and after your code so it formats correctly in the forum. I added them for you. 2.) You're code would be easier to read if it was indented properly. 3.) Looks like you need to learn about tables. 4.) Using your own sprites means that other people on the forum who don't have those sprites won't see your game the way it's supposed to run. 5.) I didn't try to run your code because there's no point because of the sprites. 6.) Because I didn't run it, I don't know anything else to comment on.

• Posts: 2

@dave1707 I have reposted this with sprites that you can use. The collision is no where close to right with the sprite images but it works.

• Posts: 8,491

@sawyer797 Remove the numbers -155 and +90 from your a and b statements in the function collision. That should help with the sprite collision.

• edited January 2015 Posts: 136

@sawyer797 maybe use a table, for loops, and math.random to make more spawning, and also spawn different items. you might find something like this cooler. Try increasing how many times it draws(drawCount), and the speed(speed). I didn't test this, tell me if there is a problem with it, or if you have a question.

``````function setup()
people = {}
type = {}
p = {}

drawCount = 3
speed = 2

for i = 0, drawCount do
temp = math.random(1,3)

if type[i] == 1 then sprite("Planet Cute:Character Pink Girl")
elseif type[i] == 2 then sprite("Planet Cute:Character Boy")
else type[i] == 3 then sprite("Planet Cute:Character Princess Girl")
end
p[i] = vec2(math.random(WIDTH, WIDTH*2), 100)
end

end
function draw()
background(255,255,255,255)
strokeWidth(5)

for i = 0, drawCount do
img = type[i]
pushMatrix()
translate(p[i].x, p[i].y)
sprite(img)
popMatrix()
p[i].x = p[i].x - speed
end

end
``````